# Guide: Device Preview

See your app on a phone, tablet or desktop size **before you deploy**. The device preview runs the real ChainRender
viewer on this project's bytes, at that device's size. You can tap through it, type into it, open its panels and test
its actions; nothing is deployed and nothing is sent.

## Open it

1. Choose the chain you are building for (top bar). The preview renders through that chain's RenderRouter.
2. **⋯ More → 📱 Device preview**, or the **📱 Device preview** button beside "Preview on-chain floor".
3. Pick a device. The list has iPhone SE, iPhone 15, iPhone 15 Pro Max, Pixel 8, Galaxy S23, iPad mini, iPad Air,
   iPad Pro, Laptop, Desktop and a custom size.
4. Use **⟲ Rotate** for landscape, and **Zoom** to look closer. Zoom never changes the size the app sees.

Keep editing: every change re-renders the preview.

## What it tells you

Under the toolbar, after each render:

- **The viewport, and your app's width.** The panel also says which theme breakpoints (sm 480, md 768, lg 1024) the
  app is below. Rows you set to stack at those widths are columns there.
- **Anything wider than the screen.** It names the element and its width. It also says whether the page scrolls
  sideways or the content is cut off at the screen's edge: both are common mobile layout bugs. Content that scrolls
  inside its own box, such as a wide table, is listed separately as possibly intended.

## Actions are simulated

Pressing a button opens the viewer's confirm panel, exactly as it will after deploy, with the decoded call. Instead of
**Sign in wallet**, it offers **Simulate (eth_call)**. This runs the call from your connected account (or the zero
address, if no wallet is connected) and tells you whether it would succeed, with a revert's reason if it would not.
Nothing is ever sent from the preview.

## What it does not simulate

The preview uses the device's size, not the device. These still need your browser's device mode or a real phone:

- touch input itself and gestures (👆 Touch applies touch *styles*, not touch input);
- pixel density (canvas and image sharpness);
- the notch and home-bar safe areas;
- the on-screen keyboard;
- the browser's own toolbars.

Check on a real phone before you publish.

## Touch styles: 👆 Touch

The viewer has rules that apply only on a touch screen, at any size: its own controls and your app's buttons, inputs and
selects become at least 44 px tall, and form text 16 px (smaller makes iOS zoom in on focus). Your app can add its own
under `@media (pointer: coarse)` or `(hover: none)`.

Your mouse drives the preview, so those rules would never match in it. **👆 Touch** in the toolbar applies them anyway:
the viewer's and your app's, exactly as a touch screen would. It is on for phones and tablets and off for desktop sizes
until you press it, and it stays on across edits. Taps are still mouse clicks; gestures are not simulated.
