Featured carousel
ProThe large carousel at the top of a media or store page: one slide in front with whole slides set back beside it, moved by a swipe, side arrows or keys, and by itself only with a Pause control. Not an M3 component (@windmorph/react-pro).
import { FeaturedCarousel, FeaturedCarouselSlide, FeaturedCarouselPlaceholder, useFeaturedCarouselSlide } 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
FeaturedCarousel 24 props
FeaturedCarouselSlideelements.The current slide (controlled).
The slide current at first (uncontrolled).
Previous, Next, the keys and the timer go round from the last slide to the first.
Moves on by itself, within WCAG 2.2.2:
true(7 seconds a slide) or{ interval }in milliseconds. It waits while a mouse is over the slides, while less than half is in view, while the tab is hidden and while a slide holds it; it stops, until Play is pressed, once the person moves it or the keyboard's focus comes in; never under reduced motion.Whether the Pause control has stopped everything that moves by itself, the slides and media in a slide (controlled). A move by hand, or the keyboard's focus coming in, stops only the slides, until Play: media in the slide the person went to goes on playing.
Whether it starts stopped (uncontrolled).
Previous and Next at the sides, for a mouse.
The dots under the slides.
Past this many slides a count ("3 of 30") stands in for the dots.
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).
Replaces the Pause control's
pauseicon.Replaces the Pause control's
play_arrowicon.Ref to the outermost element.
The outermost element's id.
Events
Called when another slide becomes current, with what moved it.
Called when the Pause control (or Play) stops or starts everything.
Text
Words the carousel says, with English defaults. A
LabelsProvidersets them for the whole app.The root's role description.
Each slide's role description.
labels.positiontype(position: string, count: string) => stringdefault (position, count) =>${position} of ${count}Each slide's name, its place.
Previous, given the carousel's name.
Next, given the carousel's name.
The Pause control while anything moves by itself.
The Pause control otherwise.
labels.announcementtype(name: string, position: string, count: string) => stringdefault (name, position, count) =>${name}, ${position} of ${count}Said after a move by hand.
labels.counttype(position: string, count: string) => stringdefault (position, count) =>${position} of ${count}In place of the dots past
maxDots.
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.
The outermost element (the named region).
The size container that holds the slides and the foot.
The scrolling row of slides.
Each slide.
The Previous side arrow's container.
The Next side arrow's container.
The row under the slides that holds the dots (or the count) and the hidden Previous and Next.
The dots.
Each dot.
The current dot's fill as its time runs.
The count ("3 of 30") shown in place of the dots past
maxDots.The Pause control.
Inline styles for the outermost element, e.g.
--wm-featured-carousel-*tokens.
FeaturedCarouselSlide 7 props
The slide's name, said with its place after a move by hand ("City after dark, 2 of 4").
It holds something that moves by itself (a video): the carousel then has its foot and Pause control from the first paint, even with one slide.
Anything: a picture, words, links, buttons, a video.
Ref to the slide's element.
The slide's id.
FeaturedCarouselPlaceholder 7 props
What stands in the slide's place: a skeleton while loading, or a notice and Try again.
The 48px foot under the slide, as a carousel with dots or a Pause control has.
Ref to the outermost element.
The outermost element's id.
Classes for the outermost element.
Classes for each part.
Inline styles for the outermost element, e.g.
--wm-featured-carousel-*tokens.
Hooks
useFeaturedCarouselSlide
Inside a FeaturedCarouselSlide: whether it is current, whether things may move, and the timer.
Returns FeaturedCarouselSlideState
This slide is the current one.
Things may move by themselves now: this slide is current, the Pause control hasn't stopped them, there's no reduced motion, the carousel is in view and the tab visible.
Holds the timer (while a video plays, say); call what it returns to let it go.
Moves the carousel on now (when a video ends, say), unless the person moved it by hand.
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 |
|---|---|---|
| Slides with a link and buttons, kept clear of the side arrows | Built | Use case · Slides |
Moving by itself, with the Pause control (autoAdvance) | Built | Configuration · Auto |
A slide that plays a video (media, useFeaturedCarouselSlide) | Built | Use case · Auto |
Loading and failed (FeaturedCarouselPlaceholder) | Built | Configuration · Loading |
| Not an M3 component | Extension | M3’s carousel doesn’t move by itself and has no Previous and Next, indicator or controls inside an item; this one follows the APG’s auto-rotating carousel, with the core carousel’s 28px item corner and words. |
| Moving by itself within WCAG 2.2.2 | Extension | Off unless asked; one Pause control stops the slides and any media in them, keyboard focus or a move by hand stops it until Play, and reduced motion keeps it still. |
Slides with a link and buttons, kept clear of the side arrows
BuiltUse case · Slides
Moving by itself, with the Pause control (
BuiltautoAdvance)Configuration · Auto
A slide that plays a video (
Builtmedia,useFeaturedCarouselSlide)Use case · Auto
Loading and failed (
BuiltFeaturedCarouselPlaceholder)Configuration · Loading
Not an M3 component
ExtensionM3’s carousel doesn’t move by itself and has no Previous and Next, indicator or controls inside an item; this one follows the APG’s auto-rotating carousel, with the core carousel’s 28px item corner and words.
Moving by itself within WCAG 2.2.2
ExtensionOff unless asked; one Pause control stops the slides and any media in them, keyboard focus or a move by hand stops it until Play, and reduced motion keeps it still.
Theming & tokens
Set the tokens below on the carousel or any ancestor. --wm-featured-carousel-control-inset is published for your slide content: the arrows' distance from the edge, which the wm-featured-carousel-content utility uses as padding so words stay clear of them. The side arrows, shared with Shelf, take the --wm-side-arrow-* tokens below, and their colours, blur and focus ring the shared --wm-on-media-* ones on the Video player page. className and aria-* go on the root, the named region; style each part with classNames: root, frame, viewport, slide, previous, next, foot, indicator, dot, progress, count, pause.
| Variable | Default | Paints |
|---|---|---|
--wm-featured-carousel-slide-width-compact | 88% | A slide’s width in a compact carousel (under 600px), of the row. |
--wm-featured-carousel-slide-ratio-compact | 4 / 5 | A slide’s shape in a compact carousel; a least height, so longer words lengthen it. |
--wm-featured-carousel-slide-width-medium | 90% | A slide’s width in a medium carousel (600px), of the row. |
--wm-featured-carousel-slide-min-height-medium | 28rem | A slide’s least height in a medium carousel. |
--wm-featured-carousel-slide-ratio-expanded | 16 / 9 | A slide’s shape from 840px. |
--wm-featured-carousel-slide-max-height | 70dvh | The tallest a slide grows from 840px, which sets its width by its shape: the one value that reads the window (set it for a carousel in a pane of its own). |
--wm-featured-carousel-slide-side-room | 8rem | What a slide leaves of the row from 840px, for its neighbours to peek in. |
--wm-featured-carousel-corner | var(--md-comp-carousel-item-container-shape, var(--md-sys-shape-corner-extra-large)) | A slide’s corners: the core carousel item’s shape (28px). |
--wm-featured-carousel-fill | var(--md-sys-color-scrim) | Behind a slide’s picture or video. |
--wm-featured-carousel-gap-compact | 8px | The space between slides in a compact carousel. |
--wm-featured-carousel-gap | 12px | The space between slides from 600px. |
--wm-featured-carousel-padding-inline-compact | 16px | A compact carousel’s side padding, before the first slide and after the last. |
--wm-featured-carousel-padding-block | 8px | The space above and below the slides. |
--wm-featured-carousel-neighbor-scale | 0.94 | How much smaller a slide beside the current one is. |
--wm-featured-carousel-neighbor-brightness | 0.5 | How much darker a slide beside the current one is (darker, not fainter: faded, it washed out on a light page). |
--wm-featured-carousel-neighbor-duration | var(--md-sys-motion-spring-spatial-default-duration) | How long size and brightness take to hand over as the slides move (at once under reduced motion). |
--wm-featured-carousel-neighbor-easing | var(--md-sys-motion-spring-spatial-default-easing) | Their easing. |
--wm-featured-carousel-foot-height | 48px | The row under the slides that holds the dots and the Pause control. |
--wm-featured-carousel-foot-gap | 12px | The space between the foot’s parts. |
--wm-featured-carousel-dot-size | 6px | A dot’s size. |
--wm-featured-carousel-dot-current-width | 24px | The current slide’s dot, which fills as its time runs. |
--wm-featured-carousel-dot-gap | 6px | The space between dots. |
--wm-featured-carousel-dot-color | var(--md-sys-color-outline) | The dots, which show how many slides there are: `outline`, since `outline-variant` falls under 3:1 against the page. |
--wm-featured-carousel-progress-color | var(--md-sys-color-primary) | The current dot’s fill as its time runs. |
--wm-featured-carousel-dot-duration | var(--md-sys-motion-spring-effects-default-duration) | How long a dot takes to widen or narrow. |
--wm-featured-carousel-dot-easing | var(--md-sys-motion-spring-effects-default-easing) | Its easing. |
--wm-featured-carousel-control-inset | 56px | The room the side arrows take at each side (their 8px inset and 48px), for slide content to keep clear of: the `wm-featured-carousel-content` utility pads by it. |
| Variable | Default | Paints |
|---|---|---|
--wm-side-arrow-padding | 4px | The container round the 40px button: 4px makes a 48px pill. |
--wm-side-arrow-inset | 8px | The arrow’s distance from the start or end edge. |
--wm-side-arrow-offset | 0px | Moves the arrows up (negative) or down from the middle of the row, e.g. level with pictures that have words under them. |
--wm-side-arrow-disabled-opacity | 0.4 | The arrow that leads nowhere, kept in place and dimmed. |
--wm-side-arrow-fade-duration | var(--md-sys-motion-spring-effects-default-duration) | How long the arrows take to show and hide (none under reduced motion). |
--wm-side-arrow-fade-easing | var(--md-sys-motion-spring-effects-default-easing) | Their easing. |