Image scrub

Several pictures of one thing in one box, stepped through by pointer position.

Example

Picture 1
tsx
<Stack style={{ maxWidth: "18rem" }}>
  <ImageScrub
    images={[{ url: "/share.png", alt: "Picture 1" }, { url: "/apple-touch-icon.png", alt: "Picture 2" }, { url: "/logo.svg", alt: "Picture 3" }]}
    aspectRatio="1 / 1"
    fit="contain"
    rounded
  />
</Stack>

Usage

Pages are built on the server: import the tags from @dash/server and return the tree. The browser runtime draws it.
tsx
import { ImageScrub } from "@dash/server";

Props

ImageScrubProps

Prop
Type
Description
images (required)ImageScrubItem[]
aspectRatiostring | numberThe box's shape, kept while scrubbing between pictures of any size: `"1 / 1"` (default), `"4 / 3"` or `1.5`.
fit"cover" | "contain"How each picture fills the box (default `cover`).
loading"lazy" | "eager"`lazy` (default) defers the first picture until it nears the viewport. The others load on first interaction.
roundedboolean | "full"Corners follow the theme: `true` is `--radius`, `"full"` is `--radius-full`.
positionLabelstringThe position announced to assistive technology, with `{{current}}` and `{{count}}`. Set by the client from `dash.imageScrub.position`.
PreviousImage
On this page