Kinetik UI

Swipe Row

.md

A list row with actions behind it; swipe far enough and the edge action takes over the row and runs.

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

Installation

Kinetik CLI
npx kinetik-ui add swipe-row

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/swipe-row.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/swipe-row.tsx
    View source files

Usage

import { SwipeRow } from '@/components/kinetik/swipe-row';

<SwipeRow
  accessibilityLabel={`${mail.from}, ${mail.subject}`}
  leading={{ key: 'pin', label: 'Pin', tone: 'azure', onPress: pin }}
  trailing={[
    { key: 'delete', label: 'Delete', tone: 'danger', dismiss: true, onPress: remove },
    { key: 'flag', label: 'Flag', onPress: flag },
  ]}
>
  <MailRow mail={mail} />
</SwipeRow>;

trailing lists actions from the edge inwards. The first one is the edge action: it runs on a full swipe. Actions with dismiss slide the row away and fold it shut before onPress runs, so remove the item from your list in onPress.

When to use

  • Quick actions on rows people process one by one: mail, notifications, tasks, saved items.
  • Lists where the same actions are also available elsewhere, for example in the item's detail screen.

When not to use

  • The only way to reach an action. Swipes are hard to discover.
  • Rows inside a horizontal scroller or carousel, where the swipe would fight the scroll.

Notes

  • A short swipe opens the actions; a fling opens them too. Tap the row to close them.
  • Past 62% of the row's width the edge action grows over the others with a tick; let go there to run it. Turn this off with fullSwipe={false}.
  • Swiping towards a side with no actions resists and springs back.
  • Every action is a custom accessibility action on the row, so screen reader users never need to swipe.

Props

SwipeRowProps

PropTypeDefaultDescription
childrenrequiredReactNode—The row's content.
accessibilityLabelrequiredstring—Names the row for screen readers; its actions are offered as custom actions.
leadingSwipeAction—Revealed by swiping right.
trailingreadonly SwipeAction[][]Revealed by swiping left, edge-most first. The first one runs on a full swipe.
actionWidthnumber76Width of each action button. Defaults to 76.
fullSwipebooleantrueA long swipe runs the edge-most action. Defaults to true.
hapticsbooleantrueA tick when a full swipe arms. Defaults to true.
testIDstring—
styleStyleProp<ViewStyle>—

Performance and accessibility

Performance

Budget
The row and its actions move on the UI thread from three shared values; a dismissed row folds its height once. Nothing runs at rest.
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 · 154 MB app memory

Real-device measurement pending.

Accessibility

Reduced motion
The row still follows the finger, but opens, closes and dismisses without springs or the slide-away.
Screen readers
The row is one element named by accessibilityLabel, with every action offered as a custom action.
Touch target
Action buttons are 76 pt wide and as tall as the row.

Source files

components/kinetik/swipe-row.tsx is in the Code tab of the preview above.