Interactive example
JL
Boarding pass

Your flight to New York is ready.

Swipe either way. Swipe fully left to delete, or use an actions button.

Installation

terminal
bunx --bun shadcn@latest add https://apple-ui-eduardo.vercel.app/r/swipe-actions.json

The registry includes the shared styles and dependencies. Import @/components/apple-ui/styles.css in your root layout once. For the package route, use the installation guide.

Usage

tsx
const deleteAction = {
  label: "Delete",
  tone: "destructive" as const,
  onAction: remove,
};

<SwipeActions
  label="Boarding pass"
  leadingActions={[{ label: "Archive", onAction: archive }]}
  actions={[deleteAction]}
  fullSwipe={{ edge: "trailing", action: deleteAction }}
>
  <ListItem title="Boarding pass" supportingText="Madrid to New York" />
</SwipeActions>

Package imports use @eduardoul/apple-ui. Registry imports use @/components/apple-ui. Add "use client" to files that use state or event handlers.

API reference

PropertyTypeDefault
actionsSwipeAction[] on the trailing edgerequired
leadingActionsSwipeAction[] on the leading edge[]
fullSwipe{ edge: SwipeEdge; action: SwipeAction; threshold?: number }undefined
fullSwipe.thresholdfraction of row width, clamped to 0.55 through 0.90.72
labelstringrequired

Use className and style to customize the component. The package includes full TypeScript definitions for its supported element properties and refs.

Design guidance

  • Use a small set of short actions so each remains easy to reach. Leading and trailing edges follow the layout direction.
  • The buttons provide both sets of actions without requiring a gesture. Escape closes the open tray.
  • Full swipe is optional. Pass the same action object in its edge array and fullSwipe configuration. Release beyond the threshold commits after the departure animation.
  • A full swipe must travel at least 24 pixels beyond the tray width. Reversing or canceling the gesture prevents the commit. The application owns removal and undo behavior.
Read Apple’s guidance

Accessibility

Provide a visible label or accessible name. Keep keyboard focus visible and check the example with your content at 200 percent zoom. Overlays use Radix for focus management and keyboard dismissal.

Library styles support reduced motion, reduced transparency, increased contrast and forced colors. Read the accessibility foundation for the checks your application still needs.