Skip to content
Hazine

Pause-First Rotating Carousel

Single-slide carousel that advances every six seconds, with the pause control first in the tab order and a timed bar on the current slide marker. Use it for announcement or testimonial rotations.

How it differs. Timer-driven: the rotation toggle and a status sentence sit before a crossfading stage, and the slide markers below double as the countdown. Hover and focus hold it, choosing a slide stops it.

Install

pnpm dlx shadcn@latest add @hazine/carousel-auto-rotate-pause-first

Adds 1 file, 1 shadcn primitive (button), 1 Hazine item (@hazine/use-controllable-state), and 1 package (lucide-react).

First time? Add the registry to components.json
{
  "registries": {
    "@hazine": "https://api.hazine.dev/r/{name}.json"
  }
}

Needed once per project. Items resolve each other through the @hazine namespace.

Props14

slides
CarouselSlide[] = DEFAULT_SLIDES
label
string = "Announcements"
Accessible name of the carousel, for example "Product news".
interval
number = 6000
Milliseconds each slide stays up. One second at least.
loop
boolean = true
Wraps from the last slide to the first. When false, rotation stops on the last slide.
rotating
boolean
defaultRotating
boolean = true
onRotatingChange
(rotating: boolean) => void
index
number
defaultIndex
number = 0
onIndexChange
(index: number) => void
loading
boolean = false
emptyAction
React.ReactNode
One action shown in the empty state.
labels
Partial<CarouselAutoRotatePauseFirstLabels>
locale
string = "en-US"

Also accepts every prop of Omit<React.ComponentProps<"section">, "children" | "ref">.

Accessibility

Keyboard
Keyboard support for Pause-First Rotating Carousel
KeyEffect
TabMoves through the rotation button, Previous slide, Next slide, the link of the visible slide, then one marker per slide. Focus arriving on any of them holds rotation until focus leaves the carousel
Enter or Space on the rotation buttonPauses or starts rotation. Start overrides the current hold, so slides rotate while focus stays on the button
Enter or Space on Previous slide or Next slideShows the neighbouring slide and stops rotation
Enter or Space on a slide markerShows that slide and stops rotation
Screen reader

A labelled section with the carousel role description. Each slide is a group named by its position. The rotation button comes first and its name switches between pause and start. The slide region is aria-live off while the timer runs and polite when it is held or paused.

  • Announces: {kicker} {title} {body} {meta} {linkLabel}, read politely when a slide changes while rotation is held or paused
  • Announces: Loading slides
Reduced motion
Starts paused and rotates only after the user presses Start rotation. Slides swap with no crossfade, the timed bar stays full and skeleton lines stop pulsing.
Checked
Not checked yet. Automated results appear here once CI has run.

Dependencies3

  • button
  • @hazine/use-controllable-state
  • lucide-react

Filled chips are registry items the CLI adds for you. Outlined chips are npm packages.

Tokens shipped0

None. The item is styled by the tokens your theme already has.

More in Media and Motion