@danolekh/cardstock
v0.5.2
Published
Headless, composable bank-card primitives for React: flip, tilt, storable backgrounds and live shader backgrounds, masked number reveal with timeouts and copy, freeze, statuses, spending meter, limit field and a swipeable card carousel.
Maintainers
Readme
@danolekh/cardstock
Headless, composable bank-card primitives for React: a card that flips and tilts, painted with backgrounds you store as data (colours, gradients, artwork or live shaders), a number that stays masked and decodes when revealed (per field, with an optional timeout and a copy action), a frozen state with a WebGL frost, card statuses, a spending meter and limit field, and a carousel you swipe between cards with.
Docs and live demos → cardstock.danolekh.com
The card's parts render plain elements and report their state as data-* attributes and CSS variables; the carousel comes with a coverflow you tune or turn off. Artwork for the backgrounds isn't in the package: npx @danolekh/cardstock-backgrounds add holo downloads it on demand. You choose the styling (Tailwind, CSS, anything) and the animation (CSS, Motion via render, or none). The design follows Base UI.
pnpm add @danolekh/cardstock @base-ui/reactStatus: 0.3.0, pre-1.0 (a minor version may change the API). React 19, @base-ui/react ^1.8, ESM only.
import { Card } from "@danolekh/cardstock";
<Card.Root>
<Card.Body>
<Card.Front>
<Card.Number value="4821 5903 2716 4822" />
</Card.Front>
<Card.Back>
<Card.SecurityCode value="731" />
</Card.Back>
</Card.Body>
<Card.FlipTrigger aria-label="Turn the card over" />
<Card.RevealTrigger>Show details</Card.RevealTrigger>
<Card.FreezeTrigger>Freeze</Card.FreezeTrigger>
</Card.Root>;Docs, live demos and styled copies you can add with the shadcn CLI: https://cardstock.danolekh.com
MIT © Dan Olekh

