Shelf
ProOne row of cards that scrolls sideways, with part of the next card showing at its end and Previous and Next at its sides for a mouse. Not an M3 component (@windmorph/react-pro).
import { Shelf, ShelfPlaceholder } from '@windmorph/react-pro';Part of Windmorph Pro, paid components on the free core, not on sale yet. See the Pro guide for what it includes and to register interest.
Props
Shelf 17 props
The cards. Each is wrapped in a list item and keeps its own
key.Cards to a line at each size of the shelf:
widefor 16:9 pictures (1.35 to 6.15),tallfor 9:16 ones (2.4 to 9.3). Never whole numbers, so part of the next card shows. An app sets its own through the--wm-shelf-per-line-*tokens.A fixed card width (a CSS length) in place of a share of the row, for cards that shouldn't grow.
Where the arrows sit up and down: the row's middle, or the middle of the first card's element marked
data-shelf-media(its picture).Shows Previous and Next for a mouse (never for touch).
Replaces Previous's chevron; it should point left (it mirrors in right to left).
Replaces Next's chevron; it should point right (it mirrors in right to left).
Ref to the outermost element.
The outermost element's id.
Text
Words the buttons say, with English defaults. A
LabelsProvidersets them for the whole app.One of
aria-labeloraria-labelledbyis required.One of
aria-labeloraria-labelledbyis required.
Classes for the outermost element. Wins over the defaults via
cn().Classes for each part.
Inline styles for the outermost element, e.g.
--wm-shelf-*tokens.
ShelfPlaceholder 7 props
The placeholder cards (e.g. ten skeleton cards, enough for the widest shelf).
Cards to a line, as the shelf it stands in for.
A fixed card width, as the shelf it stands in for.
Ref to the outermost element.
The outermost element's id.
Spec status
Not part of Material Design 3: a Windmorph Pro component, built on M3's colour roles, type scale, shapes and motion. Its variants and configurations each link to a live example.
| Item | Status | Details |
|---|---|---|
Wide (16:9) cards, the arrows centred on their pictures (arrowsAlign="media") | Built | Variant · Wide |
Tall (9:16) cards (per="tall") | Built | Variant · Tall |
Loading, with skeleton cards (ShelfPlaceholder) | Built | Configuration · Loading |
| Not an M3 component | Extension | M3’s carousel sizes its items as a share of the row and clips them; a shelf keeps an app’s own cards untouched in a plain list, with side arrows that M3’s carousel rules out. |
| Sized by its own width | Extension | Cards to a line step by the shelf’s width at the library’s size classes, never whole numbers, so part of the next card always shows. |
Wide (16:9) cards, the arrows centred on their pictures (
BuiltarrowsAlign="media")Variant · Wide
Tall (9:16) cards (
Builtper="tall")Variant · Tall
Loading, with skeleton cards (
BuiltShelfPlaceholder)Configuration · Loading
Not an M3 component
ExtensionM3’s carousel sizes its items as a share of the row and clips them; a shelf keeps an app’s own cards untouched in a plain list, with side arrows that M3’s carousel rules out.
Sized by its own width
ExtensionCards to a line step by the shelf’s width at the library’s size classes, never whole numbers, so part of the next card always shows.
Theming & tokens
Set the tokens below on the shelf or any ancestor; set the --wm-shelf-per-line-* tokens for your own number of cards at each size. The default 8px gap and no let-out suit cards in general; cards that carry their own padding set --wm-shelf-gap and --wm-shelf-let-out. The arrows are the side arrows the FeaturedCarousel uses, themed by its --wm-side-arrow-* tokens and the shared --wm-on-media-* ones on the Video player page. className goes on the root and aria-* on the list; style each part with classNames: root, list, item, previous, next.
| Variable | Default | Paints |
|---|---|---|
--wm-shelf-per-line-compact | 1.35Varies with per. | Cards to a line in a compact (under 600px) shelf, and how much of the next shows (wide cards; `per="tall"` has its own). |
--wm-shelf-per-line-medium | 3.15Varies with per. | Cards to a line in a medium (600px) shelf, and how much of the next shows (wide cards; `per="tall"` has its own). |
--wm-shelf-per-line-expanded | 4.15Varies with per. | Cards to a line in a expanded (840px) shelf, and how much of the next shows (wide cards; `per="tall"` has its own). |
--wm-shelf-per-line-large | 5.15Varies with per. | Cards to a line in a large (1200px) shelf, and how much of the next shows (wide cards; `per="tall"` has its own). |
--wm-shelf-per-line-extra-large | 6.15Varies with per. | Cards to a line in a extra-large (1600px) shelf, and how much of the next shows (wide cards; `per="tall"` has its own). |
--wm-shelf-gap | 8px | The space between cards (0 for cards that carry their own padding). |
--wm-shelf-padding-inline-compact | 12px | A compact shelf’s side padding, which the cards scroll over to the edge; the first card rests there. |
--wm-shelf-let-out | 0px | How far the row reaches past the shelf’s sides from 600px, so cards with their own padding line their pictures up with the page. |
--wm-shelf-ring-room | 4px | Room round the cards inside the scrolling row, so a focused card’s ring is never cut by its edge. |
--wm-shelf-page-share | 0.85 | How much of the row Previous and Next move, before the snap lands on a card. |