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

Android

android

Frames content inside an Android phone device mockup.

Usage

Basic usage

The Android casing with a centered punch-hole camera wraps the screen content, the default is Pixel 9 Pro.

Hulian AppAndroid screen
tsx
<Android>
  <img src="/app.png" alt="" />
</Android>

Select model

model Switch the default model and determine the default width.

Hulian AppAndroid screen
tsx
<Android model="galaxy-s24-ultra">
  <img src="/app.png" alt="" />
</Android>

Custom width

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

Hulian AppAndroid screen
tsx
<Android width={220}>
  <img src="/app.png" alt="" />
</Android>

Picture content

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

Hulian AppAndroid screen
tsx
<Android model="pixel-9-pro" imageSrc="/app.png" />

When to Use

Use it to present an app screenshot or mobile page inside an Android device frame with a hole-punch camera. Pixel and Galaxy dimensions are available. Use iPhone for an iPhone frame, Tablet for a tablet, or Safari and Chrome for browser windows.

Import

ts
import { Android, ANDROID_MODELS } from "@hulianui/ui"

Props

Extends ComponentPropsWithoutRef<"div">. ANDROID_MODELS exports the model-to-width mapping.

NameTypeDefaultDescription
model"pixel-9-pro-xl" | "pixel-9-pro" | "pixel-9" | "galaxy-s24-ultra" | "galaxy-s24"- ("pixel-9-pro" in the showcase)Optional model used to resolve the width; the component itself has no model default
widthnumberModel width, or 280 without a modelDevice width in pixels; an explicit value 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 punch-hole camera to the left edge center (#437).
statusBarbooleanfalseRenders a top system status bar (time, signal, Wi-Fi, battery) and shifts content below it so the punch-hole camera 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 gesture home indicator safe-area strip (#447).
imageSrcstring-Screen image URL; takes precedence over children

Slots

SlotTypeDescription
childrenReactNodeCustom screen content

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.
  • When both imageSrc and children are provided, imageSrc wins.

Related

iPhone · Tablet · Watch · Safari · Chrome · Terminal

Playground

Hulian AppAndroid screen
<Android model="pixel-9-pro">
  <img src="/app.png" />
</Android>
PreviousiPhoneDevice MockupsNextTablet

On this page

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