Loomguides

Previews on a phone

What a preview does on a 390px screen, and the `?base=` opt-out for a wide composition.

Open a preview on a phone and the scene lays out against the phone’s screen, as the engine would on that device. Nothing needs configuring.

The stage is the viewport

The size of the preview’s mount is the Roblox viewport. Loom feeds it to the layout engine and to Workspace.CurrentCamera.ViewportSize. On a narrow screen:

  • text re-wraps,
  • a UIListLayout with Wraps re-flows,
  • AutomaticSize re-measures,
  • a scene that branches on ViewportSize takes its narrow path.

A layout of fixed offsets wider than the screen runs off the edge and is clipped, as it would on a real device. The generated pages size with dvh, so the stage doesn’t hide under a mobile browser’s toolbars.

?base= keeps a wide composition

If you embed a preview at a narrow width and want the desktop layout shrunk to fit, add ?base=:

A 1280-wide logical viewport, whatever the frame is
/loom-preview/index.html?target=src%2Fscenes%2FCounter.loom.tsx&chrome=none&base=1280
ValueEffect
absentThe default. The scene lays out against the real viewport.
?base=<px>Lay out at this width. Below it, the stage scales down to fit; at or above it, nothing changes.
?base (bare)Same as ?base=960. An unreadable value also means 960.
?base=none (or off, or 0)The default, spelled out, for a host page that always templates the param.

A wider base keeps more of the desktop layout but draws everything smaller. At 960 a phone renders at about 40%; at 1280, about 30%, where body text stops being readable.

The debug panel shows both the real and the logical size, and the scale between them. ?base= is part of the URL contract.

When the stage is scaled, loom converts pointer positions back to layout pixels, so clicks land where the scene appears. That covers MouseEnter, Activated and InputChanged positions, GetMouseLocation, and wheel deltas.

Touch

  • A drag inside a ScrollingFrame scrolls it, with the same clamping as the mouse wheel. Past a small threshold the drag stops counting as a tap, so dragging across a button doesn’t activate it.
  • Only ScrollingFrames capture touch panning. Everywhere else the page scrolls normally, so an embedded preview never traps the reader’s scroll.
  • Taps register immediately, without the browser’s ~300ms double-tap delay.

In the full gallery, the 248px sidebar becomes a top bar with a targets button. Picking a target closes it. With ?chrome=none there is no sidebar, so an embedded preview only gets the touch handling.