Duolith docs

Pager

One page of a set at a time, such as onboarding cards, with previous, next, a dot per page, and a swipe left or right to move on or back.

Stability: experimental

Props

PropTypeDefaultMeans
labelstringWhat the pages are; the group's accessible name.
pages{ title: string; body?: string; image?: string }[]The pages, each with a title, and text and a picture if it has them.
pagenumberbindable(0)The page shown, counted from 0. Bind it with bind:page={name}.

States

StateLooks like
defaultThe current page in a card, then previous, the dots and next.
at an endPrevious on the first page and next on the last are dimmed and cannot be pressed.

Accessibility

rolegroup
nameThe label prop; each page is a group named n of count.
focusTab reaches previous, each dot, then next.
keyboardEnter and Space press them.
notesThe current page's dot is marked aria-current. A swipe left on the page moves on and a swipe right back (on:swipe, decision 0121); the buttons do the same, so the swipe is never the only way.

Theme tokens

color.surface color.border color.primary color.ink color.muted radius.md radius.full space.2 space.3 space.4 text.heading text.body

Example

<Pager label="Welcome" pages={welcome} bind:page={page} />