Command Palette

Search for a command to run...

2.3kGitHub stars
Components

Swipe Actions

Swipe a row in a list to reveal actions on the left or right.

Loading…

Features

Built on top of React Swipe Actions.

  • Drag with pointer or touch, or open a focused row with the arrow keys.
  • Snaps open on distance or a flick. A full swipe runs the action outright.
  • Only one row open at a time, dismissed by Escape or an outside click.
  • Keeps closed strips inert and respects prefers-reduced-motion.

Installation

pnpm dlx shadcn@latest add @ncdai/swipe-actions

Usage

import {
  SwipeAction,
  SwipeActions,
  SwipeContent,
  SwipeItem,
  SwipeRoot,
} from "@/components/swipe-actions"
<SwipeRoot>
  <SwipeItem>
    <SwipeActions side="right">
      <SwipeAction />
      <SwipeAction fullSwipe />
    </SwipeActions>
 
    <SwipeContent />
  </SwipeItem>
</SwipeRoot>

Composition

Use the following composition to build a SwipeItem

SwipeRoot
└── SwipeItem
    ├── SwipeActions
    │   └── SwipeAction
    └── SwipeContent

Examples

Minimal

The smallest setup that works: one action on one side.

Loading…

Choosing the full swipe action

fullSwipe can sit on any action in the strip. Put it on the safe one so a destructive action still needs a deliberate tap.

Loading…

References

Was this helpful?

Command Palette

Search for a command to run...