cardstock

Styling

Every data attribute and CSS variable the parts write.

Every part renders a single element with a data-slot naming it, for example [data-slot="card-front"]. Its state is written as data-* attributes. Values that change continuously are CSS variables, which inherit, so any descendant can use them.

className and style accept functions of state, like in Base UI:

<Card.Root className={(state) => (state.frozen ? "grayscale" : "")} />

render swaps the element for another tag or your own component:

<Card.Root render={<section />} />
<Card.Body render={<motion.div animate={{ rotateY: flipped ? 180 : 0 }} />} />

Reference

PartData attributesCSS variables
Card.Rootdata-flipped, data-frozen, data-revealed
Card.Tiltdata-hovering, data-disabled--card-pointer-x/y, --card-tilt-x/y
Card.Bodydata-flipped--card-flipped
Card.Front, Card.Backdata-side, data-visible
Triggersdata-pressed, data-disabled
Card.Number, Card.SecurityCodedata-revealed, data-animating--char-count
their cellsdata-char-state--char-index, --group-index
Card.Holder, Card.Expirydata-revealed
Card.FrozenOverlaydata-open, data-starting-style, data-ending-style
Card.Spendingdata-over-limit--card-spending-ratio
CardCarousel.Rootdata-dragging--carousel-position
CardCarousel.Trackdata-dragging
CardCarousel.Slidedata-active--slide-offset, --slide-offset-clamped, --slide-distance
CardCarousel.Indicatordata-active

On this page