Hero Slider
ProNewFull-width hero slides with photo, video or colour backgrounds, headline, text and CTA, with arrows, four pagination styles, a progress bar and autoplay.
Installation
First time? Add the @viewport registry to components.json. Setup takes one minute.
Usage
Props
| Prop | Type | Default |
|---|---|---|
| slides* | HeroSlide[] | — |
| transition | "slide" | "fade" | "zoom"How one slide replaces the next. | "slide" |
| duration | numberLength of the transition, in seconds. | 0.6 |
| autoplay | booleanAdvance on a timer. Never runs under reduced motion. | true |
| interval | numberSeconds each slide stays up while autoplay runs. | 6 |
| loop | booleanWrap around from the last slide to the first. | true |
| arrows | booleanShow the previous and next arrows. | true |
| mobileArrows | booleanKeep arrows available on narrow screens instead of hiding them. | false |
| arrowPreview | booleanPreview the neighbouring slide on arrow hover or keyboard focus. | false |
| pagination | "strokes" | "bullets" | "numbers" | "thumbnails" | "none"The style of the page indicator. | "strokes" |
| progress | booleanShow a bar across the top that fills while a slide is up. | true |
| kenBurns | booleanSlowly zoom the background while a slide is up. | false |
| radius | numberCorner radius of the slider, in pixels. | 16 |
| minHeight | numberShortest height of a slide on wide screens, in pixels. Slides grow to fit their text. | 440 |
| mobileMinHeight | numberShortest height on narrow screens; without it, use 72% of `minHeight`. | — |
| label | stringNames the slider for screen readers. | "Featured" |
| onSlideChange | (index: number) => voidCalled with the new index after every change. | — |
| className | string | — |
Accessibility
- A labelled carousel: each slide is a group named “2 of 4”, and arrows, dots and thumbnails are named buttons.
- Autoplay pauses on hover, on keyboard focus and in a background tab, and has its own pause button.
- Left and Right change slide from anywhere inside; swipe works on touch screens.
- Slide changes are announced only when you make them, not while autoplay runs.
- Under reduced motion autoplay, the zoom and video playback stay off and slides swap with a short fade.