Examples
Manual slide navigation
Use previous and next controls or left and right arrow keys.
Project overview
A concise description of the current project.
Three workstreams are on schedule.
Project summary carousel
import { Carousel } from "@phuctech/ui/components/carousel";
const slides = [{ id: "overview", title: "Project overview", description: "A concise description of the current project.", content: <p>Three workstreams are on schedule.</p> }, { id: "activity", title: "Recent activity", description: "The latest changes in this workspace.", content: <p>Two updates were made this week.</p> }, { id: "next", title: "Next milestone", description: "The next meaningful checkpoint.", content: <p>Review the project plan on Friday.</p> }];
export function Example() {
return <Carousel label="Project summary" slides={slides} />;
}
Optional automatic rotation
Rotation stops for reduced motion, focus, pointer hover, or an explicit pause action.
First update
Rotation pauses when focus or pointer enters the carousel.
Auto-rotating carousel
import { Carousel } from "@phuctech/ui/components/carousel";
const slides = [{ id: "one", title: "First update", content: <p>Rotation pauses when focus or pointer enters the carousel.</p> }, { id: "two", title: "Second update", content: <p>Users can pause or resume automatic rotation.</p> }];
export function Example() {
return <Carousel label="Automatic updates" slides={slides} autoPlay intervalMs={5000} />;
}
No slides
An empty set is announced without rendering disabled navigation controls as active.
No slides are available.
Empty carousel state
import { Carousel } from "@phuctech/ui/components/carousel";
export function Example() {
return <Carousel label="No featured items" slides={[]} />;
}
Try the carousel
Inspect a compact schedule summary.
Today
Four tasks are due today.
Carousel property playground
import { Carousel } from "@phuctech/ui/components/carousel";
const slides = [{ id: "today", title: "Today", content: <p>Four tasks are due today.</p> }, { id: "tomorrow", title: "Tomorrow", content: <p>Two reviews are scheduled for tomorrow.</p> }];
export function Example() {
return <Carousel label="Schedule highlights" slides={slides} />;
}
Usage
import { Carousel } from "@phuctech/ui/components/carousel";
<Carousel label="Project summary" slides={slides} />Rotation
Manual navigation is the default. When autoPlay is enabled, the component provides a pause/resume control and stops rotation while a pointer hovers, keyboard focus is inside, or reduced motion is enabled. Delay is clamped to two through thirty seconds. Use a carousel only when the hidden slides are supplemental; important content should remain visible without rotation.
API
Accessibility
The region and current slide have descriptive names. Previous/next buttons are labeled, left/right arrows navigate when focus is inside, and live announcements are disabled only while automatic rotation is active. A visible pause/resume button remains available.