iPhone
A mockup of the iPhone
import { Iphone } from '@/registry/magicui/iphone'
export function IphoneDemo() { return ( <div class="w-108.5"> <Iphone /> </div> )}Examples
Section titled “Examples”With Image
Section titled “With Image”import { Iphone } from '@/registry/magicui/iphone'
export function IphoneDemo2() { return ( <div class="w-108.5"> <Iphone src="https://placehold.co/900x1600?text=Hello+World" /> </div> )}With Video
Section titled “With Video”import { Iphone } from '@/registry/magicui/iphone'
export function IphoneDemo3() { return ( <div class="w-108.5"> <Iphone videoSrc="https://videos.pexels.com/video-files/8946986/8946986-uhd_1440_2732_25fps.mp4" /> </div> )}Installation
Section titled “Installation”pnpm dlx shadcn@latest add @magicui-solid/iphonebunx shadcn@latest add @magicui-solid/iphoneyarn dlx shadcn@latest add @magicui-solid/iphonenpx shadcn@latest add @magicui-solid/iphoneImport
Section titled “Import”import { Iphone } from '@/components/magicui/iphone'<Iphone />| Prop | Type | Default | Description |
|---|---|---|---|
src |
string |
- |
The source of the image to display |
videoSrc |
string |
- |
The source of the video to display |
class |
string |
- |
Additional classes applied to the wrapper <div> |
style |
JSX.CSSProperties |
- |
Inline styles applied to the wrapper <div> |
- Sizing: width and height props have been removed. The size is controlled by the wrapper
<div>. The component enforces the aspect ratio 433/882. - Masking: The screen area is only masked when media (src or videoSrc) is provided. Without media, only the frame is rendered.
- HTML Attributes: The Iphone component accepts all standard HTMLDivElement props.
- iOS Compatibility: Video is rendered as a DOM overlay instead of foreignObject to avoid Safari/iOS masking issues.
Original:
magicui.design/docs/components/iphone