Skip to main content
v7

CardStack

Review a deck one card at a time by dragging, flicking, pressing a button or using the arrow keys, with undo.

Package@g4rcez/componentsSectionDisplay Components

Examples

Language shortlist

Drag the top card, flick it, use the Skip and Learn buttons or the arrow keys while the stack is focused. Undo flies the last card back from the side it left. Only the top four cards render however long the deck is.

Language cards

Systems

Rust

Memory safety without a garbage collector.

fn main() {
    println!("Hello");
}
Drag a card or use the left and right arrow keys to decide. Press Backspace to undo.

Decide a card to see it here.

When to use CardStack

Use when

Use CardStack for one-by-one triage: learning lists, review queues and onboarding picks, especially when a left or right decision should be undoable.

Avoid when

Avoid it when people need to compare items side by side, where a list or table fits, and for browsing without deciding, where a carousel fits. For quick actions on list rows use SwipeableList.

Accessibility

The stage is a focusable group described as a card stack, with a hint for the controls. Left and Right arrows decide the top card and Backspace, Cmd+Z or Ctrl+Z undo. The top card is labelled with its position, such as Rust, 1 of 4, and the cards beneath are hidden from assistive technology. Buttons offer every gesture, so swiping is never required, and decisions, undo and reset are announced politely. Touch swipes use touch-action pan-y, so vertical scrolling still works.