StackedCards
Drag the top card away and it slips to the back of the pile. Cards.
Open playgroundBrief
Define the one moment worth animating.
Block
Lay out the static state first.
Move
Add motion that carries meaning.
Ship
Respect reduced motion, then release.
About
StackedCards is a React component in the Cards category of smoui. It is typed, ships no stylesheet, follows your theme through CSS variables, and honors prefers-reduced-motion. Import it with import { StackedCards } from "@ashutoshswamy/smoui" and set cards, threshold, cardClassName among its 4 props.
Install
npm i @ashutoshswamy/smouiUsage
import { StackedCards } from "@ashutoshswamy/smoui";
<StackedCards
className="w-56"
cardClassName="h-40 rounded-2xl bg-neutral-100 p-5"
cards={[<p>Brief</p>, <p>Block</p>, <p>Move</p>]}
/>Props 4
- cards
Card contents, first is on top.
ReactNode[]- threshold
Drag distance in px that sends a card back.
numberdefault90- cardClassName
Class on each card.
string- className
Class on the stack. Arrow keys also cycle.
string
More cards components
- AvatarGroupA tucked stack of avatars. Point at one and it lifts, its neighbours part around it and a tooltip names it. The +N chip opens the rest as a list.
- BadgeA short status label in five tones, soft or solid, with an optional icon. A number inside rolls to its new value.
- BookingCardPick a day, pick a time, book. One pill slides between choices and the button names what you are about to book.
- CartSummaryA small basket. Each row opens its Add button into a stepper, and the subtotal rolls digit by digit up or down with every change.
- CommentThreadA conversation that reads as one. Replies hang off a thin rail and fold away, likes count as they change, and the reply box opens in place and grows as you type.
- CompareStatThis period against the last. Totals and the change on top, paired bars below; point at a pair and the caption names both numbers.