jbmui

PhoneFrame

  • UI Bits

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-frame

Needs the @jbm entry in components.json; see Install once.

Also installs @jbm/tokens, @jbm/paper.

Usage

Phone holding interface pieces
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. w and h set it directly; rotate tilts 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.

PropTypeDefaultDescription
wnumber420Width in stage pixels, including the edge; sets edge thickness, radius, padding (10% of w, plus 8% extra on top), and the speaker slot.
hnumber780Height in stage pixels, including the edge.
rotatenumber0Tilt in degrees; applied as a CSS rotate, so the layout box stays w × h.
childrenReact.ReactNodenoneScreen content, stacked as a column from the bottom up.
styleReact.CSSPropertiesnoneInline styles merged last; can override padding, alignment, or transform.
gapnumber26Space 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.