PhoneFrame
Phone silhouette with a thick ink edge and speaker slot that stacks your content at the bottom of its screen.
Install
npx shadcn@latest add @jbm/phone-frameNeeds the @jbm entry in components.json; see Install once.
Also installs @jbm/tokens, @jbm/paper.
Usage
import { PhoneFrame } from "@/jbm/ui/phone-frame"import { UiCard } from "@/jbm/ui/ui-card" // install @jbm/ui-card separatelyimport { UiButton } from "@/jbm/ui/ui-button" // install @jbm/ui-button separately<PhoneFrame w={200} h={360} gap={14} rotate={-2}> <UiCard w={130} h={100} /> <UiButton w={130} h={40} /></PhoneFrame>Props
- Stage px
- Declared at the documented defaults
- Landscape
420 by 780- Vertical
420 by 780- Basis
Fixed w × h box (border-box) at the defaults 420 × 780.
wandhset it directly;rotatetilts it visually without changing the layout box, and the shadow extends below.
Card-stock phone with an ink edge (1.6% of w, at least 5px), corner radius 13% of w, the paper shadow, and a speaker slot near the top. Children lay out as a centred column pushed to the bottom of the screen (justify flex-end). Content is not clipped or scaled to fit.
| Prop | Type | Default | Description |
|---|---|---|---|
w | number | 420 | Width in stage pixels, including the edge; sets edge thickness, radius, padding (10% of w, plus 8% extra on top), and the speaker slot. |
h | number | 780 | Height in stage pixels, including the edge. |
rotate | number | 0 | Tilt in degrees; applied as a CSS rotate, so the layout box stays w × h. |
children | React.ReactNode | none | Screen content, stacked as a column from the bottom up. |
style | React.CSSProperties | none | Inline styles merged last; can override padding, alignment, or transform. |
gap | number | 26 | Space between children in stage pixels. |
QA checks
- Fill the screen with children taller than the inner area: they overflow the top edge (nothing clips), so size content to h minus the padding.
- Check small w: the edge floors at 5px and the speaker slot at 5px tall.
- Rotate by a few degrees and confirm corners and shadow stay inside the composition's safe area.