Skip to main content
Version: latest
Works everywhere

Carousel works in both server and client environments. Always use the standard import (e.g. @prokodo/ui/carousel) — the library detects the runtime automatically.

Carousel

Carousel renders a horizontal sliding view of items with optional autoplay, loop, navigation arrows, and pagination dots.

Live demo →

Overview

import { Carousel } from "@prokodo/ui/carousel"
;<Carousel
items={[
{ key: "1", content: <img src="/slide1.jpg" alt="Slide 1" /> },
{ key: "2", content: <img src="/slide2.jpg" alt="Slide 2" /> },
]}
autoplay
/>

Import

import { Carousel } from "@prokodo/ui/carousel"

CSS:

import "@prokodo/ui/carousel.css"

Props

PropTypeDefaultRequiredDescription
childrenReactNodeSlide elements rendered inside the carousel.
autoplaynumberAutoplay interval in ms (0 or undefined disables).
enableControlbooleantrueShow previous/next control buttons.
enableDotsbooleantrueShow dot indicators.
translateXnumberManual slide offset override.
itemStyleReact.CSSPropertiesInline styles applied to each slide item.
itemsToShownumber1Number of items visible at once.
responsiveCarouselResponsive[]Breakpoint-based itemsToShow overrides.
classNamestringCSS class on root element.

See src/components/carousel/Carousel.model.ts for the full CarouselProps type.


Design Tokens

Customise via CSS custom properties on :root or a scoped ancestor element.

TokenDefaultDescription
--pk-carousel-overlay-bgcolor-mix(in srgb, var(--pk-palette-grey-900) 70%, transparent)Mobile tutorial overlay background
--pk-carousel-dot-active-bgvar(--pk-color-fg)Active pagination dot fill
--pk-carousel-button-paddingvar(--pk-space-xs)Prev/next navigation button padding
--pk-carousel-dots-mt0Top margin above the dot indicator row
--pk-carousel-controls-mtvar(--pk-space-lg)Top margin between slides and the controls row (prev/dots/next)

WCAG 2.2 Status

CriterionNameStatusNote
1.3.1Info and Relationships (A)✅ FulfilledSemantic structure (headings, lists, labels, landmarks) must be conveyed programmatically via HTML or ARIA.
2.1.1Keyboard (A)✅ FulfilledAll functionality must be operable via keyboard alone, without requiring specific timing.
2.2.2Pause, Stop, Hide (A)🔍 Manual reviewAnimations or auto-rotating content lasting more than 5 s must provide a pause/stop control.
2.4.3Focus Order (A)🔍 Manual reviewThe keyboard focus sequence must preserve meaning and operability in the complete page integration context.
2.4.7Focus Visible (AA)🔍 Manual reviewA visible keyboard focus indicator must be present on every interactive element. Verify against the applied product theme.
4.1.2Name, Role, Value (A)✅ FulfilledName, role, and state of all interactive UI components must be programmatically determinable via native HTML semantics or ARIA.

Test coverage: 2 jest-axe assertion(s) across 5 test file(s) · 3 ARIA attribute occurrence(s) in source scan. Criteria marked 🔍 require manual verification in the final product integration and theme context.

Storybook

👉 Open Carousel in Storybook


Source

src/components/carousel/Carousel.model.ts