datui
Color scheme

Data display

CardScroll

A horizontally scrolling list of cards with snapping, optional gutters and arrows that move by one card. Built on HorizontalScroll.

import { CardScroll } from "datui";

Examples

Sizes

size sets each card's width; false keeps the card's own width.

  • Card 1
  • Card 2
  • Card 3
  • Card 4
  • Card 5
  • Card 6
  • Card 7
  • Card 8
  • Card 9
  • Card 10
  • Card 1
  • Card 2
  • Card 3
  • Card 4
  • Card 5
  • Card 6
  • Card 7
  • Card 8
  • Card 9
  • Card 10
  • Card 1
  • Card 2
  • Card 3
  • Card 4
  • Card 5
  • Card 6
  • Card 7
  • Card 8
  • Card 9
  • Card 10

Accessibility

  • Renders a <ul>; every child becomes an <li>, so screen readers announce the number of cards.
  • Native scrolling and snapping; the viewport is focusable while it overflows so arrow keys scroll it.
  • Arrow buttons are aria-hidden and out of the tab order; interactive cards stay reachable with Tab.

API

CardScroll

Horizontally scrolling row of cards rendered as a list. Each child becomes a list item, cards snap to the start edge and arrows move by one card.

PropTypeDefaultDescription
arrowOffsetXstring | number—Distance of the arrows from the inline edges (CSS length or px).
arrowOffsetYstring | number—Vertical shift of the arrows from the center (CSS length or px).
arrowSize"s" | "m""m"
classNamestring—
contentClassNamestring—
paddingbooleanfalseAdds inline gutters before the first and after the last card.
scrollOnAnyWheelbooleanfalseMap vertical mouse-wheel movement to horizontal scrolling. Shift+wheel always works natively.
showArrowsboolean | "always"true`true` shows arrows on devices with a fine pointer, `"always"` on every device.
sizefalse | "s" | "m" | "l"sWidth of each card. `false` keeps each card's own width.
viewportClassNamestring—Classes for the scrolling viewport element.
viewportRefRef<HTMLDivElement>—Ref to the scrolling viewport element.