Skip to content

Carousel

Copy editable source into an initialized application:

Terminal window
pnpm dlx @simurgh-ui/cli add carousel

For package consumption, import from the component subpath and load its optional recipe CSS:

import {
Carousel,
CarouselContent,
CarouselItem,
CarouselPrevious,
CarouselNext,
} from '@simurgh-ui/react/carousel';
import '@simurgh-ui/styles/carousel.css';
import {
Carousel,
CarouselContent,
CarouselItem,
CarouselPrevious,
CarouselNext,
} from '@simurgh-ui/vue/carousel';
import '@simurgh-ui/styles/carousel.css';
import {
CarouselComponent,
CarouselContentComponent,
CarouselItemComponent,
CarouselPreviousComponent,
CarouselNextComponent,
} from '@simurgh-ui/angular/carousel';
import '@simurgh-ui/styles/carousel.css';

Omit the component stylesheet for fully headless styling. CLI-copied components use the local path written to simurgh.json and the copied application styles instead of these package imports.

Carousel exposes a named region, one visible slide at a time, positional slide labels, bounded controls, and logical Arrow Left/Right navigation. Enable loop only when wrapping is expected.

The optional component stylesheet provides a complete default recipe, including visual hierarchy and interaction states. Consumers can override semantic tokens or omit the recipe.

Live component Carousel
Design system

Shared accessible patterns for product teams.

The public component parts are listed in API surface below. Use only the parts needed by the example; compound components depend on their documented parent/child nesting.

Controlled state remains the application’s source of truth and must be updated from every change event. Uncontrolled state reads its default only when the component mounts. Do not pass both forms of the same state at once.

FrameworkExact state contract and reset behavior
ReactNo public controlled/uncontrolled state pair is exposed.
VueControlled: v-model:index (index + update:index). Uncontrolled: defaultIndex. Reset the model ref to its initial value; reset uncontrolled state with a changed Vue :key.
AngularNo public two-way state binding is exposed.

Vue

<script setup lang="ts">
import { ref } from 'vue';
const initial = '';
const state = ref(initial);
const resetKey = ref(0);
</script>
<Carousel v-model:index="state"></Carousel>
<button @click="state = initial">Reset controlled</button>
<Carousel :key="resetKey" :defaultIndex="initial"></Carousel>
<button @click="resetKey++">Reset uncontrolled</button>

The carousel itself is focusable in Angular; in React and Vue, arrow events from focused controls bubble to the root. Supply concise slide content and avoid automatic advancement unless users can pause it.

<Carousel label="Featured projects">
<CarouselContent>
<CarouselItem>Design system</CarouselItem>
<CarouselItem>Documentation</CarouselItem>
</CarouselContent>
<CarouselPrevious></CarouselPrevious>
<CarouselNext></CarouselNext>
</Carousel>

These keys describe behavior implemented by the adapters. Native Tab, Enter, and Space behavior still applies to descendant links, buttons, and form controls unless the component overrides it.

Concern / keysBehavior
Focus entry and exit (Tab / Shift+Tab)Tab reaches the viewport and controls in DOM order.
Navigation and activationArrow Left/Right moves to the previous/next item.
EscapeNot handled by the component.
RTL differencesPrevious/next Arrow Left/Right mapping reverses in RTL.
TypeaheadNot supported.

Preserve the documented composition and accessible names when wrapping or restyling this component. See accessibility and RTL guidance for keyboard, focus, labeling, and directionality requirements.

  • React exports: Carousel, CarouselContent, CarouselItem, CarouselPrevious, CarouselNext
  • Vue exports: Carousel, CarouselContent, CarouselItem, CarouselPrevious, CarouselNext
  • Angular exports: CarouselComponent, CarouselContentComponent, CarouselItemComponent, CarouselPreviousComponent, CarouselNextComponent

Import these public symbols from the component subpath shown in Installation. Framework-specific props, events, slots, directives, methods, defaults, and native-attribute behavior belong in the API tables on this page; use the linked source only to verify the current implementation.

React API reference

An inherited-attributes entry means the component accepts the complete named React native interface, including its event handlers and ARIA and data attributes. Remaining attributes are forwarded to the rendered element unless the component behavior described on this page overrides them.

Inherited attributes: HTMLAttributes<HTMLDivElement>.

PropTypeDefault / requirement
childrenReactNodeundefined
defaultIndexnumberundefined
directionDirectionundefined
labelstringundefined
loopbooleanundefined
onIndexChange(index: number) => voidundefined

Inherited attributes: HTMLAttributes<HTMLDivElement>.

PropTypeDefault / requirement
childrenReactNodeundefined

Inherited attributes: HTMLAttributes<HTMLDivElement> & RefAttributes<HTMLDivElement>.

PropTypeDefault / requirement
childrenReactNodeundefined
refRef<HTMLDivElement> | undefinedundefined

Inherited attributes: ButtonHTMLAttributes<HTMLButtonElement>.

PropTypeDefault / requirement
childrenReactNodeundefined

Inherited attributes: ButtonHTMLAttributes<HTMLButtonElement>.

PropTypeDefault / requirement
childrenReactNodeundefined
Vue API reference

Boolean props without explicit defaults use Vue’s false default. Undeclared attributes follow the fallthrough behavior stated for each component.

Vue attribute fallthrough is enabled for the rendered root.

PropTypeDefault / requirement
labelstring'Carousel'
directionDirection'ltr'
loopbooleanfalse
defaultIndexnumber0
EventPayload
update:indexnumber

Slots: default.

Exposed methods: none.

Vue attribute fallthrough is enabled for the rendered root.

No declared props.

No emitted events.

Slots: default.

Exposed methods: none.

Vue attribute fallthrough is enabled for the rendered root.

No declared props.

No emitted events.

Slots: default.

Exposed methods: none.

Vue attribute fallthrough is enabled for the rendered root.

No declared props.

No emitted events.

Slots: default.

Exposed methods: none.

Vue attribute fallthrough is enabled for the rendered root.

No declared props.

No emitted events.

Slots: default.

Exposed methods: none.

Angular API reference

Inputs and outputs use their public template names. Public methods are callable through a template reference or ViewChild. Native attributes apply to the documented template root or directive host; they are not automatically forwarded through component hosts.

Component selector: simurgh-carousel. The template’s first native element is ng-content. Angular host bindings: { 'data-slot': 'carousel', role: 'region', 'aria-roledescription': 'carousel', '[attr.aria-label]': 'label', '[attr.dir]': 'direction', tabindex: '0', }.

InputTypeDefault / requirement
labelstring'Carousel'
directionDirection'ltr'
loopbooleanfalse
defaultIndexnumberundefined
OutputPayload
indexChangenumber

Content projection: default.

Public method
register(item: CarouselItemComponent): void
unregister(item: CarouselItemComponent): void
itemIndex(item: CarouselItemComponent): number
goTo(next: number): void
onKeydown(event: KeyboardEvent): void

Component selector: simurgh-carousel-content. The template’s first native element is ng-content. Angular host bindings: { 'data-slot': 'carousel-content', 'aria-live': 'polite' }.

No inputs.

No outputs.

Content projection: default.

No public methods.

Component selector: simurgh-carousel-item. The template’s first native element is ng-content. Angular host bindings: { 'data-slot': 'carousel-item', role: 'group', 'aria-roledescription': 'slide', }.

No inputs.

No outputs.

Content projection: default.

No public methods.

Component selector: simurgh-carousel-previous. The template’s first native element is button.

No inputs.

No outputs.

Content projection: default.

No public methods.

Component selector: simurgh-carousel-next. The template’s first native element is button.

No inputs.

No outputs.

Content projection: default.

No public methods.

Follow the framework example as a structural contract. Root components own shared state; parts that consume that state must stay under the root (or be attached to projected descendants in Angular). Parts described as conditional are optional until their corresponding interaction or semantic region is used. Do not render a state-consuming part by itself.

FrameworkRequired parent/child relationshipConditional partsSupporting types
ReactRender Carousel as the ancestor. Nest the listed parts inside that root so they can read its shared state/context.CarouselContent, CarouselItem, CarouselPrevious, CarouselNext are conditional parts: include only those needed by the documented anatomy. A trigger/control and its matching content/item are required when that interaction is used.None.
VueRender Carousel as the ancestor. Nest the listed parts inside that root so they can read its shared state/context.CarouselContent, CarouselItem, CarouselPrevious, CarouselNext are conditional parts: include only those needed by the documented anatomy. A trigger/control and its matching content/item are required when that interaction is used.None.
AngularCreate CarouselComponent first. Attach listed directives to elements inside its projected content; nested component parts must remain inside it.CarouselContentComponent, CarouselItemComponent, CarouselPreviousComponent, CarouselNextComponent are conditional parts: include only those needed by the documented anatomy. A trigger/control and its matching content/item are required when that interaction is used.None.

Accessible names, descriptions, and form labels remain required whenever the component’s purpose cannot otherwise be determined, even when the corresponding visual part is optional.

The adapters target the same user-visible behavior and accessibility contract. Their public shapes follow each framework’s conventions and are not expected to be symbol-for-symbol identical.

ConcernContract
Public compositionAll adapters export 5 public symbols, with framework-idiomatic names.
State and change eventsReact uses controlled/default props and callbacks for index; Vue uses v-model:index; Angular uses [(index)].
Children and contentReact uses children; Vue uses the slots listed above; Angular uses the documented content projection selectors.
Native attributesReact forwards the named native interface; Vue follows the stated fallthrough rule; Angular attributes apply to the component host unless an input, directive, or documented native root consumes them.
Imperative accessReact forwards native refs; Vue exposes no methods; Angular exposes no public methods.

These differences are intentional adapter design. Behavioral or accessibility differences not stated on this page are parity defects rather than supported variations.

This component is not a form control and does not contribute a named value to FormData. Use it to structure or describe a form only when its purpose and accessibility guidance apply.

The table distinguishes component behavior from application-owned presentation. “Not supported” means there is no public state contract for that adapter; do not invent one with an undocumented attribute. Keep status and error messages accessible when they are rendered outside the component.

StateReactVueAngular
LoadingNot supported by this component API; handle this state in surrounding application UI.Not supported by this component API; handle this state in surrounding application UI.Not supported by this component API; handle this state in surrounding application UI.
EmptyNot supported by this component API; handle this state in surrounding application UI.Not supported by this component API; handle this state in surrounding application UI.Not supported by this component API; handle this state in surrounding application UI.
InvalidNot supported by this component API; handle this state in surrounding application UI.Not supported by this component API; handle this state in surrounding application UI.Not supported by this component API; handle this state in surrounding application UI.
Read-onlyNot supported by this component API; handle this state in surrounding application UI.Not supported by this component API; handle this state in surrounding application UI.Not supported by this component API; handle this state in surrounding application UI.
DisabledSupported with disabled={true} on the documented control or interactive part; its interaction is blocked. Disabled form controls are omitted from submission.Not supported by this component API; handle this state in surrounding application UI.Not supported by this component API; handle this state in surrounding application UI.
ErrorNot supported by this component API; handle this state in surrounding application UI.Not supported by this component API; handle this state in surrounding application UI.Not supported by this component API; handle this state in surrounding application UI.
Styling contract

The selectors below are used by the published component recipe or emitted consistently by an adapter. Treat these as the supported styling surface. Element order, anonymous wrappers, and undocumented descendants are implementation details and should not be targeted.

SurfaceStable hooks
Recipe classesNo component-specific recipe class; this stylesheet currently imports shared tokens only.
Stable DOM parts[data-slot="carousel"], [data-slot="carousel-content"], [data-slot="carousel-item"], [data-slot="carousel-next"], [data-slot="carousel-previous"]
Stable data attributes[data-index], [data-slot]
ARIA/state selectors used by the recipeNo ARIA state selector is used by this recipe.
CSS custom properties consumed--simurgh-border, --simurgh-foreground, --simurgh-radius, --simurgh-ring, --simurgh-surface

Prefer a semantic token override for theme-wide changes. Use the listed class or part selectors for a component-scoped override. When omitting recipe CSS, preserve state attributes and ARIA semantics even if your replacement styles use different selectors.

Load the optional component stylesheet for the default recipe, override semantic tokens for broad theme changes, or omit the recipe CSS for headless styling. See theming and styling hooks for import order, selectors, dark mode, RTL, and reduced-motion guidance.

Last verified on 2026-08-13 against Simurgh registry 0.1.1.