shadcn.io is not affiliated with official shadcn/ui
Download App Dialog Block for React
A hiking-map app landing page with its install dialog shown open: a QR code to scan, App Store and Google Play links named in text, iPhone and Android install steps in tabs, and a text-me-a-link field that sends nothing.
Installation
Overview
Get a visitor from a desktop page onto their phone, with this install dialog for React with Base UI. It opens from the landing page of Ridgefold, an offline hiking-map app: the header holds an outline Get the app Button, and the page, a top bar, a headline, two buttons and a phone showing a trail map, is drawn under a soft scrim inside a hairline frame with a plus mark on each corner. The Dialog shows a QR Code of the download page with "Scan with your phone's camera" under it, and two outline buttons for the App Store and Google Play, named in text beside a two-letter tile. Next to them Tabs hold iPhone and Android with three numbered steps each, the first tab always the same since the page does not sniff the browser. Under it a phone Input offers to text the link: Text me the link, the only Shine Button, checks the number and says what it would do, and nothing is sent. On a phone the code is hidden, because you are already on one, and the store links lead. For preview the dialog is drawn open in place when the page loads; the header button opens the real Dialog.
FAQ
Why is the dialog already open, and what do I keep?
So you can see it without a click. On load the dialog is a copy drawn in place over the page: a native dialog element that isn't modal, so nothing is trapped, hidden or focused, and the page around the preview keeps working. The Get the app button opens the real Dialog, modal, with its focus trap, Escape and focus return, and the copy stays closed until a reload. Both show the same InstallFields component and share the block's state, so a number typed in the copy is there in the real one. In your app keep the Dialog and drop the copy: the "in-place" state, the scrim and the dialog element inside the frame.
Is the QR code real, and where does it point?
It is a real QR code, drawn by the catalog component from the address in LINK, so a phone pointed at the screen reads it. The address is a placeholder; point it at a page that detects the phone and forwards to the right store, so one code serves both. The code sits in a light tile with a ring so it stays readable in a dark theme.
Do the store links go anywhere?
No. App Store and Google Play are links to # whose handlers say in a polite message that they go nowhere in this demo. Their tiles are two typed letters, not logos. In your app link to your store pages and follow each store's badge and trademark rules if you use their official artwork, which is up to you.
What stays local in the demo, and how do I wire it up?
Text me the link checks that the number has 7 to 15 digits, then says "A text with the link would go to ..." and nothing is sent; a number that doesn't pass shows its problem under the field and keeps focus there. In your app post the number to your server in text, have the server send one message with the link and rate-limit it, and keep the message's wording in the dialog's hint so people know what they agreed to.
Is it accessible from the keyboard?
Yes. The two tabs are a tab list you move through with the arrow keys, the steps are numbered lists named for the phone, the store links are real links, and the field is named by its label. The trigger is passed to DialogTrigger through render, and the dialog is controlled with open and onOpenChange. The copy shown on load moves no focus; Escape inside it, Close and its close button close it and put focus on Get the app. One polite message reports what a press did.
How does it look on a phone?
The copy shown on load docks to the foot of the page as a bottom sheet, its actions pinned at the bottom with Text me the link on top. The code is hidden and the two store buttons come first, then the install steps and the phone field, all scrolling above the actions. The real dialog keeps the Dialog's own phone layout: a sheet stuck to the bottom of the screen.
Related
- Pro
QR Scanner Dialog
Media and widgetsAn event check-in page with a simulated scanner dialog shown open: a viewfinder around a real sample QR code, a Wi-Fi, link and ticket payload read in turn, a result card that names the kind and cuts it into parts, a typed-code tab and a recent-scans strip.
- Pro
QR Download Split Banner
Split calloutsA scan-to-install callout for a mobile app: a real QR code in a card in card with a caption, beside the heading, one sentence and links to both store listings.
- Pro
App Download Login
Split with a panelA reverse split sign-in page for a running tracker: a real QR code of a download link with an iOS and Android switch that re-encodes it, a copyable link, and the sign-in form beside it. On a phone the code gives way to a Get the app link.
- Pro
App Rating Download Footer
Calls to actionA footer for a grocery-list app with a star rating, the phone versions it supports, and two store links in the brand column, beside three groups of links.
- Pro
Phone Frame Mockup Hero
Mobile and mediaA centred showcase hero for a mobile app on solid rails: store links with a Shine Button, a phone showing the app between two cards, fading out over a ruled band of three stats.
- Pro
Add Card Dialog
Payments and plansA transit wallet's payment methods page with its add-card dialog shown open: a card drawn in greys that fills in as you type, a number that groups itself and names its network, checks on the number, expiry and code, and an Add card button that keeps only the last four digits.