Skip to content
Sign in
FramesTablet frameMenu

Tablet framePro

A generic tablet mockup in portrait and landscape, with an optional keyboard case and safe area insets for the content.

ProA landscape tablet in a keyboard case, running a chat in a reading width column.

Installation

$ pnpm dlx shadcn@latest add @chatcn-pro/tablet-frame

Usage

tsx
import { TabletFrame } from "@/components/ui/chatcn/pro/tablet-frame"

<TabletFrame width={640} orientation="landscape" keyboard>
  <YourApp />
</TabletFrame>

The screen exposes its safe area as --chatcn-safe-top, --chatcn-safe-right, --chatcn-safe-bottom and --chatcn-safe-left, in viewport px, the way env(safe-area-inset-*) reads on the device. Pad with pt-(--chatcn-safe-top) and friends.

Examples

Orientation and keyboard case

The keyboard case only fits in landscape. It is drawn the way product shots show it from the front: the tablet floats on its hinge and the case is a thin slab under it.

ProPortrait and landscape, with the keyboard case on or off.

Props

PropTypeNotes
widthnumberRendered width in px. Everything scales from it. Capped at the container
finish"auto" | "silver" | "graphite" | "black" | "white"Hardware material. auto is silver in light, graphite in dark. light and dark still work as aliases for silver and graphite
shadingbooleanMetal sheen, specular edges, chamfer and glass reflection. false draws flat tones. Default true
shadowbooleanLayered contact shadow, plus a floor shadow under upright devices. Default true
glarebooleanA soft diagonal reflection on the screen glass. Default false
viewportnumberCSS width the content renders at before it scales. Smaller makes the UI larger
screenClassNamestringClass names for the screen, for example dark
orientation"portrait" | "landscape"Default portrait
keyboardbooleanKeyboard case under the tablet. Landscape only
statusBarboolean | ReactNodeClock and date at the start, glyphs at the end
homeIndicatorbooleanDefault true
buttonsbooleanDefault true

Keyboard

The frame adds nothing to the tab order.

Accessibility

  • Hardware, the keyboard case and the status bar are aria-hidden.

Motion

  • Orientation changes turn the tablet a quarter turn over 300 ms, or fade for 150 ms under reduced motion.
  • Frames are static. Nothing animates on hover.
  • Under forced-colors: active, the shell and the screen get a system color outline, so the silhouette survives without fills.