shadcn.io is an independent project built on shadcn/ui
On this page9 sections
The Android component draws a phone around the screen you want to show: a screenshot, a screen recording, or a screen laid out in your own markup. The body is an SVG in your theme's colors, with a punch-hole camera and two keys on its right edge, and it scales with the width you give it. Reach for it in a landing page hero, or beside a feature a screenshot explains best.
For an iOS app, use iPhone. A website reads better in a browser window, which Safari draws.
Installation
Anatomy

Usage
import { Android } from "@/components/ui/android";Size the phone by its width and the height follows. alt describes the screenshot for screen readers.
<Android
alt="The home screen of the app"
className="w-64"
src="/screens/home.png"
/>Accessibility
The drawn body and the camera are SVGs marked aria-hidden, so a screen reader meets only the screen. Your alt becomes the screenshot's alt, or the video's aria-label when there is one, and a still under the video is then marked as decoration. Describe what the screen shows, such as a cart with two items, or leave alt empty when the text beside the phone already says it. A screen built from children is read like any other markup, so when it is only an illustration, add inert to the phone to hide it and keep its links out of the tab order. A video gets a Pause video button that takes focus, or under reduced motion its own controls.
Demos
Video
A short time-lapse of a red flower opening plays on the screen through videoSrc, muted, looping and cropped to fill it, with a pause button on hover. Under reduced motion it waits with its controls showing instead. Use a recording when the point is motion, such as a pull to refresh or a swipe through onboarding, and keep it small, since it downloads once the phone scrolls into view.
App
The screen here is markup: a status bar, the date, a card for a design review starting in 25 minutes, and three tasks with their times. Every color is a theme token, so the screen turns dark with the page. Build the screen this way when its text should stay sharp and change with the language. At w-72 the phone is 288px wide and the screen about 271px.
Sizes
Three phones at w-24, w-36 and w-48, lined up along their bottom edges, each with a different image on screen. A width class is all a phone needs, since its height, keys and camera scale from it. The small sizes suit a row of screens in a feature grid, where each phone illustrates one step.
FAQ
How do I put a screenshot in the Android mockup?
Pass the image's URL as src and describe it in alt. The image covers the screen with object-cover, centered, so whatever doesn't fit the screen's shape is trimmed evenly from both ends.
The screen is 9 by 20, so a 1080 by 2400 screenshot fills it exactly, and a taller capture loses a strip at the top and bottom. For another crop, leave src out and pass your own img as a child, with absolute inset-0 size-full object-cover and a position such as object-top.
Can the Android mockup play a screen recording in React?
Yes. Pass the recording's URL as videoSrc and it plays muted, looping and inline, cropped to the screen like an image. The component starts it from an effect rather than the autoplay attribute, so a visitor who has turned on reduced motion sees it paused, with its controls showing.
It plays only while the phone is on screen, and a round button in the screen's bottom corner pauses and resumes it. The button shows on hover, on keyboard focus and on touch screens, and stays visible while the video is paused, which is also how it looks when the browser refuses to start the video. Pass a still as src as well, which shows under the video until its first frame arrives.
How do I size the Android phone mockup?
Give it a width, with a class such as w-64 or from the element around it. The height follows the phone's 382 by 830 shape, so a 256px phone stands about 556px tall, and without a width class it fills its container up to 382px.
Leave the height alone. With both sides fixed, the screen stretches to the new shape while the drawn body keeps its proportions and centers itself, so the two stop lining up.
Can I build the Android screen in markup instead of a screenshot?
Yes. Pass the screen as children, and it fills the screen box, clipped to its rounded corners, as in the App demo. Give the outer element h-full and lay it out like a small page about 94% as wide as the phone, 271px in a phone 288px wide.
Children paint above src and videoSrc, so markup laid over a screenshot shows without a position of its own. A video's pause button sits above the children, in the screen's bottom corner.
How do I make the Android mockup dark on a light page?
Add the dark class to the phone. With shadcn's usual setup, where dark mode is a dark class that redefines the color variables, the phone then draws in the dark palette on any page. Its colors all come from your theme, border for the rim and keys, card for the body and muted for an empty screen, so without that class it is light on a light page and dark on a dark one.
Markup on the screen turns dark with it, while a screenshot stays as it is. To change every phone at once, edit the fill classes in the component's file, which is yours once installed.
Does the Android mockup lazy-load its screenshot or video?
The video waits, the screenshot doesn't. src renders a plain img with no loading attribute, so the screenshot downloads with the page, which suits a phone at the top of a landing page. The video has preload="none" and plays only while the phone is on screen, so nothing of it downloads until the phone scrolls into view, or under reduced motion until the visitor presses play.
For a phone further down the page, leave src out and pass your own image as a child, with loading="lazy" and absolute inset-0 size-full object-cover.
Can I show a live website inside the Android mockup?
Yes. Pass an iframe as the screen, with size-full and a title that names the site, which is what a screen reader announces for the frame. At the phone's full 382px width the screen is 360px across, a common width for an Android browser, so the site lays itself out as it would on the phone.
Only sites that allow framing load, since many refuse it in their headers. Leave some room at the top of the screen so the camera doesn't sit on the site's header.
Should I use the Android or the iPhone mockup?
Use the one that matches your screenshots, since an Android capture has its own status bar and navigation that look out of place in an iPhone. The two take the same props, src, videoSrc, alt and children, so switching is a change of name.
The shapes differ. The iPhone's screen is a little wider for its height, with the Dynamic Island over it, so at the same width it stands shorter than the Android. For a website rather than an app, use Safari.
API Reference
Android
<div> data-slot="android"
alt?string
What the screenshot or video shows, read by screen readers. Leave it empty when the picture is decoration.
- Default
""
src?string
An image that fills the screen, cropped to it from the centre.
videoSrc?string
A video that fills the screen, muted and looping. It plays on its own while it's on screen, with a button to pause it, except under reduced motion, where it waits with its controls showing.
className?string
Merged with the part's classes.
data-paused?string
Present after onPause.

















