Hulian UIv0.93.5413 components0 components
  • Start
  • Components
  • Blocks
  • Pages
  • Demos
  • Changelog
ChineseEnglish
  • ComponentsComponents
  • ThemeTheme

Windows

  • Safari
  • WindowFrame
  • Chrome
  • Terminal

Devices

  • iPhone
  • Android
  • Tablet
  • Watch

iPhone

iphone

Frames content inside an iPhone-style shell with a Dynamic Island.

Usage

Basic usage

The iPhone casing with Smart Island wraps the screen content, the default model is 15 Pro.

Hulian AppScreen contents
tsx
<IPhone>
  <img src="/app.png" alt="" />
</IPhone>

Select model

model Switch the default model and determine the default width.

Hulian AppScreen contents
tsx
<IPhone model="16-pro-max">
  <img src="/app.png" alt="" />
</IPhone>

Custom width

width takes precedence over the model default width when passed in explicitly.

Hulian AppScreen contents
tsx
<IPhone width={220}>
  <img src="/app.png" alt="" />
</IPhone>

Picture content

Pass imageSrc and directly render the App screenshot (priority to children).

Hulian AppScreen contents
tsx
<IPhone model="15-pro" imageSrc="/app.png" />

When to Use

Wrap App screenshots/mobile pages into the iPhone body (Smart Island) frame for display. It is commonly used for landing pages and AppStore images. If you want an Android punch-hole screen body, use Android, if you want a tablet, use Tablet, if you want a browser window frame, use Safari/Chrome.

Import

ts
import { IPhone, IPHONE_MODELS } from "@hulianui/ui"

Props

Inherited from ComponentPropsWithoutRef<"div">. IPHONE_MODELS Export model→width mapping constant.

NameTypeDefaultDescription
model"16-pro-max" | "16-pro" | "16-plus" | "16" | "15-pro" | "13-mini""15-pro"(showcase)Default model, determines the default width.
widthnumbermodel default, if there is no model, 280Device width (px); takes precedence over model. In landscape, defaults to the 90-degree rotated portrait width.
orientation"portrait" | "landscape""portrait"Device orientation; landscape swaps inner screen dimensions and moves the Dynamic Island to the left edge center (#437).
statusBarbooleanfalseRenders a top system status bar (time, signal, Wi-Fi, battery) and shifts content below it so the Dynamic Island never overlaps page headers (#447).
statusBarTimestring"9:41"Clock text shown on the left side of the status bar when statusBar is enabled (#447).
statusBarTone"auto" | "light" | "dark""auto"Color scheme for the status bar and home indicator: "auto" follows the host theme, while "light" / "dark" forces a light or dark system bar (#447).
homeIndicatorbooleanfalseRenders a bottom system home indicator safe-area strip (#447).
imageSrcstring-Screen content image address, taking precedence over children.

Slots

SlotTypeDescription
childrenReactNodeScreen content customization node.

Usage Guidelines

  • Body height is derived from the screen ratio and the border, never a hard-coded aspectRatio. The border is a fixed pixel value while the screen scales with the width, so the body ratio is not a constant: the same device drawn at 280px and at 360px has two different body ratios. A hard-coded ratio therefore skews the inner screen at some widths, and PreviewSandbox fit scaling leaves a white band on the short edge (#117). The logical screen resolution and border width live in lib/device-metrics, and a unit test locks the invariant that the inner screen ratio always equals the declared screen ratio.
  • model and width change only the body width; the height follows from the screen ratio, so the body aspect ratio shifts slightly with width. That is correct behaviour, because the border does not scale. Clip at an outer layer if you need a different shape.
  • When both imageSrc and children are provided, imageSrc takes precedence.

Related

Android · Tablet · Watch · Safari · Chrome · Terminal

Playground

Hulian AppScreen contents
<IPhone model="15-pro">
  <img src="/app.png" />
</IPhone>
PreviousTerminalDevice MockupsNextAndroid

On this page

  • Usage
  • Documentation
    • When to Use
    • Import
    • Props
    • Slots
    • Usage Guidelines
    • Related
  • Playground