Components

Swipe Actions

Swipe a row to reveal actions, like in a phone's mail app.

Install with one command, or copy the files

Preview

Swipe a chat left or right. On a laptop, drag it or swipe with two fingers on the trackpad. Swipe all the way to delete.

Sokha Chan7:52 AM

Still on for coffee at seven?

Dara KimYesterday

ផ្ញើឯកសារហើយ សូមពិនិត្យមើល

Bopha LimTue

Thanks for the photos from Kep!

Vibol SokMon

The meeting moved to Friday.

Install

pnpx sothearo add swipe-actions

It checks whether you use Vue, Nuxt or React, and adds only the files you need to your components folder, in swipe-actions/. They're yours to change.

Usage

Wrap any row. Give it actions for each side, and handle them in one place. The row needs a solid background so the actions stay hidden behind it.

Inbox.vue
<script setup lang="ts">
import SwipeActions from "@/components/swipe-actions/SwipeActions.vue";

const trailing = [
  { id: "mute", label: "Mute", color: "#5e5ce6" },
  { id: "delete", label: "Delete", color: "#ff453a" },
];

function handle(action) {
  if (action.id === "delete")
    removeChat();
}
</script>

<template>
  <SwipeActions :trailing="trailing" full-swipe @action="handle">
    <ChatRow class="bg-white" />
  </SwipeActions>
</template>

How it moves

  • The row only takes over once you drag sideways, so the page still scrolls.
  • Past the last action it slows down like a rubber band instead of stopping hard.
  • Letting go, it opens or closes from how far and how fast you moved.
  • With full-swipe, dragging past 60% stretches the outer action across the row and runs it.
  • You can catch the row while it's still moving.
  • Only one row is open at a time, and tapping outside closes it.

Props

PropTypeDefaultWhat it does
leadingSwipeAction[][]Actions revealed by swiping right.
trailingSwipeAction[][]Actions revealed by swiping left.
full-swipebooleanfalseA long swipe runs the outer action.

Each action has an id, a label for screen readers, and an optional color.

Events and slots

NameGives youWhen
@actionactionAn action is tapped or swiped all the way.
#actionactionReplace what each action shows, like an icon.
open(side), close()Call them through a template ref.

Customise

swipe.css
[data-swipe-actions] {
  --swipe-actions-size: 40px;
  --swipe-actions-gap: 10px;
  --swipe-actions-duration: 400ms;
}

Size and gap also set how far the row opens, so there's nothing to keep in sync. The row carries data-open with the side that's open, and data-dragging while you drag.

Accessibility

  • Every action is a real button with a label.
  • Tabbing to an action opens its side, so keyboard users can reach everything without swiping.
  • Motion turns off when the system asks for reduced motion.
Code by day, manga by night.2026