Valyro Русская версия

Swipe Action Card

Swipe a card sideways to reveal its actions. Free, MIT · Interactive blocks › Stickers, tickets and boards

A card that slides sideways to uncover its actions. The card follows the finger, the actions grow in from under it, and on release it springs open or closed with the speed it was let go at (a flick is enough); one explicitly allowed action can run on a long swipe, on release, and fills the strip as it arms. Vertical movement stays page scrolling. Every action is also in the Actions toolbar, the result is shown only once the app confirms it, and Undo appears only when the app can undo.

Installation

npx valyro-cli@latest add swipe-action-card
npx shadcn@latest add https://valyro.xyz/r/swipe-action-card.json
npm install valyro-ui

import 'valyro-ui/styles.css';
import { SwipeActionCard } from 'valyro-ui';

Props

PropTypeDefault
itemId *stringStable identity of the card, passed back to onAction.
startActionsSwipeAction[][]Actions uncovered by a swipe toward the inline end.
endActionsSwipeAction[][]Actions uncovered by a swipe toward the inline start.
onAction *(actionId: string, itemId: string) => SwipeActionResult | void | Promise<SwipeActionResult | void>Runs an action. While its promise is pending the card waits and takes no other action; a rejection shows the error with a retry, and nothing pretends it succeeded. Whether the card then leaves the list is up to the app.
fullSwipeAction{ side: SwipeSide; actionId: string } | nullnullThe one action a long swipe may run on release, by side; null (default) allows none.
onUndo(result: SwipeActionResult) => void | Promise<void>Undoes a result the app marked undoable. Without it no Undo is offered.
undoDurationnumber5000How long Undo stays, ms; focus and hover pause it, 0 keeps it until used. Expiry only hides it. Default 5000.
disabledbooleanfalseNo swipe and no actions.
children *ReactNodeThe card content. Links, fields and text selection inside keep working.
labelsPartial<SwipeActionCardLabels>Overrides for the built-in English text; keys left out keep their defaults.

Related components

  • Peel Sticker — A sticker you peel back by its corner to reveal what is under it
  • Scratch Reveal — Scratch off a cover to reveal text or a picture
  • Tear-off Ticket — A ticket whose stub tears off along the perforation
  • Split-Flap Board — Mechanical departure board: only the changed characters flip
  • Feature Hotspots — Numbered points on an image that open a note about each detail
  • Exploded Layers — Prepared image layers pulled apart with captions
  • Prediction Card — The reader guesses first, then sees the answer and the explanation
  • Detail Dial — Choose how deep an explanation goes: short, detailed or full
  • Version Scrubber — Step through prepared versions of a design with one slider
  • Page Minimap — Schematic map of a long page with the visible area
  • Sticker Board — A free composition of photos, stickers and notes to move and rotate
  • Lasso Select — Drag a rectangle to select a group of cards

Previous: Split-Flap Board · Next: Sticker Board · All Interactive blocks