Viewport overlay
v0.64.0, changelogBetaChrome over a map, point cloud, 3D view or camera: ViewportOverlay places it 16 px from the frame's edges and lets the pointer through; ViewportPanel is one piece, Float or scrim.
Pick the goal on the map
Stale · last scan 14:02:31
On map
Install
npx shadcn add @syncrobotic/viewport-overlay Also installs: @syncrobotic/cn
Overview
When to use
- A mode banner, a legend or a Stale notice over a map or a canvas.
- The zoom and fit group in the bottom left of a view.
- A message over a whole view (Reconnecting), on the scrim.
- Paused, or a camera's alarm, over a video picture (
variant="scrim"or Float).
Use something else
- A message that a view has nothing to show: Empty state.
- A panel beside the view, not over it: Card.
- A tray or a save bar at the bottom of a page: the Float recipe on the shell.
More examples
States and real uses. Each example is also a Storybook story and a visual regression test.
Message
Over picture
Usage rules
- Everything drawn over a map, a point cloud, a 3D view or a camera goes in a
ViewportOverlay: 16 px from the frame's edges, pieces 8 px apart. Never a corner of your own (top-3).left-3 - Each piece is a
ViewportPanel: Float (bg-float, opaque in high contrast) over a map or a canvas,shadow-float ring-1 ring-edge backdrop-blur-xl variant="scrim"for words straight over a picture. Neverbg-background, which is the page, and never a card's ring with a shadow. - One radius, the buttons' (
rounded-sm): a zoom group over the view takesrounded-sm, so its shadow follows its corners.shadow-float - Bottom left for the view's controls (zoom, fit, reset); keep the bottom right clear for the emergency stop. Top for what the view says about itself (a mode, a legend, Stale); top right for a compass or axes.
- The overlay lets the pointer through to the canvas; give what is pressed inside it
pointer-events-auto. A message over the whole view isposition="center"onbg-scrimwhen the view behind it is not to be trusted. - Status in a panel is the glyph and the word in the status colour; the panel and the other words stay neutral.
Changelog
- 0.64.02026-12-01Formatted with Prettier (class order sorted); the code is unchanged.
- 0.53.02026-11-27Its doc opens with its description, word for word; the code is unchanged.
- 0.51.02026-11-27Comments trimmed to what they need to say; the code is unchanged.