tapcn
Components

Swipeable Row

A row component that reveals action buttons on swipe.

Swipe me left or rightTry swiping to reveal actions

Swipeable Row

A swipeable row that reveals hidden action buttons when the user swipes left or right. Supports configurable action widths, snap-back behavior, and full-swipe triggers. Pair with SwipeAction to build the action buttons.

Installation

npx @tapcn/cli add swipeable-row

Or using shadcn directly:

npx shadcn@latest add https://tapcn.vercel.app/r/swipeable-row.json

Usage

import { SwipeableRow, SwipeAction } from '~/components/ui/swipeable-row';
import { Text } from 'react-native';

export function SwipeableRowExample() {
  return (
    <SwipeableRow
      rightActions={
        <SwipeAction
          onPress={() => console.log('Deleted')}
          className="bg-destructive"
        >
          <Text className="text-sm font-medium text-destructive-foreground">
            Delete
          </Text>
        </SwipeAction>
      }
      rightActionWidth={80}
      onSwipeLeft={() => console.log('Full swipe left')}
    >
      <Text className="bg-background px-4 py-3 text-foreground">
        Swipe me left to reveal actions
      </Text>
    </SwipeableRow>
  );
}

SwipeableRow Props

PropTypeDefaultDescription
childrenReact.ReactNode-The front content of the row.
leftActionsReact.ReactNode-Content revealed when swiping right.
rightActionsReact.ReactNode-Content revealed when swiping left.
leftActionWidthnumber80Width in pixels of the left action area.
rightActionWidthnumber80Width in pixels of the right action area.
onSwipeLeft() => void-Callback fired on a full swipe to the left.
onSwipeRight() => void-Callback fired on a full swipe to the right.
classNamestring-Additional CSS classes for the outer container.

SwipeAction Props

PropTypeDefaultDescription
onPress() => void-Callback fired when the action button is pressed.
classNamestring-Additional CSS classes for the action button.
childrenReact.ReactNode-Content rendered inside the action button.

Dependencies

  • react-native-reanimated

On this page