AddThisFeature

Device Preview Toolbar

Check the design at phone, tablet, and desktop widths without leaving the editor.

simple Editors & Builders

What it adds

A toolbar above the editor canvas that constrains the canvas to phone, tablet, or desktop width so the author can see how the layout responds.

What your agent is told to do

5
  1. 1

    Take the widths from the app's real breakpoints. If a responsive token system or a responsive QA matrix already defines them, read from that source rather than inventing round numbers that do not match anything the app ships.

  2. 2

    Scale the frame down to fit the available editor space instead of forcing the page into a horizontal scrollbar. The author is checking layout, not driving a sideways scroll.

  3. 3

    Keep the canvas fully editable at every width. Clicking, dragging, and inline text editing must land on the right element after scaling, which means the pointer coordinates have to be mapped through the scale factor.

  4. 4

    Preserve the canvas scroll position across a width change so the author stays on the section they were working on rather than being returned to the top.

  5. 5

    Do not build a second read-only preview mode alongside the editor. A separate preview drifts out of sync with the editing canvas and doubles the rendering code you have to keep correct.

Edge cases it handles

7
  • Constraining the canvas by adding a horizontal scrollbar defeats the purpose. Scale the frame proportionally to fit the available width and show the true pixel width as a label.
  • Scaling a frame breaks hit testing unless coordinates are transformed. Dragging, selection handles, and inline text editing must all still land on the element under the cursor at every zoom level.
  • Switching from desktop to phone must not scroll the author back to the top of a long page. Keep the vertical position anchored to the same content, not to the same pixel offset.
  • Arbitrary widths mislead. Use the breakpoints the stylesheet actually declares, so a layout that looks correct in the toolbar is correct in a real browser.
  • The chosen width should persist per person across sessions, since someone designing a mobile-first page does not want to reset to desktop on every load.
  • Content that depends on the viewport rather than the container, such as sticky headers or full-height sections, will not respond to a scaled frame. Say so in the interface rather than showing a misleading result.
  • Very narrow widths on a small laptop screen leave the frame tiny. Set a floor on the scale factor and allow scrolling below it rather than rendering something unreadable.

Definition of done

8
  • Preview widths match the breakpoints declared in the app's stylesheet.
  • The canvas scales to fit rather than producing horizontal page scroll.
  • Selection, dragging, and inline editing work correctly at every preview width.
  • Scroll position is preserved when the width changes.
  • The last chosen width is remembered per user across sessions.
  • There is one canvas, not a separate preview renderer.
  • The feature matches the existing design system.
  • No existing functionality is broken.

Related features

How it works

  1. 1

    Copy the link

    Grab the Markdown instruction URL for this feature.

  2. 2

    Give it to your AI

    Paste it into Claude Code, Cursor, v0, Lovable — whatever you build with.

  3. 3

    It inspects, then implements

    Your agent reads your existing app first, then adds the feature to fit it.

Works with your stack

These instructions are written to adapt. They tell the agent to detect your framework, match your existing design system, and reuse what you already have — rather than assuming a particular stack.

Need it tighter than that? Customize the feature and tell it exactly what you're running.