Kinetik UI

Deckfall

.md

A stack of cards swiped away one at a time, with the cards behind rising into place.

v1.0.0Live on webreact-native-gesture-handlerreact-native-reanimatedreact-native-worklets
Component preview

Installation

Kinetik CLI
npx kinetik-ui add deckfall

The CLI copies the source and installs native dependencies with npx expo install, so versions match your Expo SDK. With shadcn: npx shadcn@latest add https://kinetik-ui.dev/r/deckfall.json

Install manually

  1. Install dependencies
    npx expo install react-native-gesture-handler react-native-reanimated react-native-worklets
  2. Copy the source files
    • components/kinetik/deckfall.tsx
    View source files

Usage

import { Deckfall, type DeckfallHandle } from '@/components/kinetik/deckfall';

const deck = useRef<DeckfallHandle>(null);

<Deckfall
  ref={deck}
  data={places}
  keyExtractor={(p) => p.id}
  renderCard={(p) => <PlaceCard place={p} />}
  onSwipe={(p, direction) => direction === 'right' && save(p)}
  leftLabel="Skip"
  rightLabel="Save"
  style={{ height: 320 }}
/>;

<Button title="Save" onPress={() => deck.current?.swipe('right')} />;

Give the deck a height; cards fill it. A drag past threshold (30% of the width) or a quick flick swipes the card; anything less springs back.

When to use

  • Deciding on one item at a time: triage, discovery, flashcards, onboarding choices.
  • Short sets where each item deserves full attention.

When not to use

  • Browsing or comparing. A list or grid shows more at once.
  • Anything users may want to undo often; swiped cards are gone unless you add your own undo.

Notes

  • Always offer buttons (via ref.swipe) next to the deck; not everyone can or wants to drag.
  • Screen readers get the top card only, with swipe actions named after your labels.
  • The drag is horizontal; vertical movement passes through to scroll views.
  • A tick plays when a drag crosses the threshold, so users feel when letting go will swipe.

Props

DeckfallProps

PropTypeDefaultDescription
datarequiredreadonly T[]—
keyExtractorrequired(item: T, index: number) => string—
renderCardrequired(item: T, index: number) => ReactNode—
onSwipe(item: T, direction: SwipeDirection, index: number) => void—Called after a card leaves the deck.
onEmpty() => void—Called once the last card has left.
renderEmpty() => ReactNode—Rendered when no cards are left.
visiblenumber3Cards visible in the stack, including the top one. Defaults to 3.
thresholdnumber0.3Fraction of the deck width a drag must cross to swipe. Defaults to 0.3.
leftLabelstring—Stamps shown on the top card while dragging left / right, e.g. "Skip" / "Save".
rightLabelstring—
hapticsbooleantrueTicks when a drag crosses the swipe threshold. Defaults to true.
refRef<DeckfallHandle>—Imperative handle with `swipe(direction)`.
styleStyleProp<ViewStyle>—
cardStyleStyleProp<ViewStyle>—Style of each card frame (radius, background, padding).

Performance and accessibility

Performance

Budget
Only visible cards (plus one) are mounted. Dragging updates two shared values on the UI thread; each card evaluates one style worklet.
Measured

Pixel 9 emulator, API 35, release build · interaction median 0.90× the system Settings app on the same emulator (indicative only) · no frames drawn at rest · 158 MB app memory

Real-device measurement pending.

Accessibility

Reduced motion
No tilt or vertical drift; a swiped card fades out quickly instead of flying away.
Screen readers
Only the top card is exposed, with 'swipe left' and 'swipe right' actions named by leftLabel/rightLabel. Other cards are hidden.
Touch target
The whole top card.

Source files

components/kinetik/deckfall.tsx is in the Code tab of the preview above.