ShadcnUI.Components.Media.Carousel (shadcn_ui v1.0.0)

Copy Markdown View Source

A named native inline scroller, complete ordered list and real fragment index.

Supply a unique id and exactly one of accessible_label or labelledby. Each item needs a stable string key, a text label and trusted HEEx body. labelledby references caller-owned headings that must exist in the document. Optional description is escaped text with a derived relationship.

The region is a Tab stop; native arrow/wheel/touch scrolling and child controls remain browser-owned. Index links target focusable list items, not selected slides. There is no autoplay, previous/next controller, live announcement, roving focus, clone or JavaScript. All items remain in accessibility order.

Snap is :proximity by default, or :none / :mandatory. It is temporarily subordinate to child focus: snapping pauses while an item or its descendant is focused so oversized content stays reachable. Alignment is :start or :center. Missing snap retains ordinary scrolling; without CSS the complete ordered list and index remain. Motion :none, an ancestor data-shadcn-motion="reduce", or system reduced motion disables smooth scrolling. Applications own destinations, item order, child semantics and restoration after replacement, which can reset native scroll and focus.

Summary

Functions

Renders native scrolling and a complete item index without slide state.

Functions

carousel(assigns)

Renders native scrolling and a complete item index without slide state.

Attributes

  • id (:string) (required)
  • accessible_label (:string) - Defaults to nil.
  • labelledby (:string) - Defaults to nil.
  • description (:string) - Defaults to nil.
  • snap (:atom) - Defaults to :proximity. Must be one of :none, :proximity, or :mandatory.
  • alignment (:atom) - Defaults to :start. Must be one of :start, or :center.
  • motion (:atom) - Defaults to :system. Must be one of :system, or :none.
  • class (:any) - Defaults to nil.
  • Global attributes are accepted.

Slots

  • item (required) - Accepts attributes:
    • key (:string) (required)
    • label (:string) (required)
    • class (:any)
    • rest (:map)