Getting Started

iOS Mail-style swipe actions for list rows.

Swipe partway to reveal a row's actions, or all the way to commit the main one. A vertical drag still scrolls the page, a quick flick opens a row even over a short distance, and only one row is open at a time.

Priya Nair

Pushed the fix, can you take a look?

Northwind

Your invoice #2291 has been paid.

Sam Ortega

Photos from Saturday are up.

Linear

3 issues were assigned to you.

Installation#

Install the package from your command line.

pnpm add tuckaway

Create a row#

Compose the parts. Each side's actions stay hidden until the row is swiped that way.

mail-row.tsx
import * as Tuckaway from "tuckaway/react";

export function MailRow({ mail, onArchive, onDelete }) {
	return (
		<Tuckaway.Row value={mail.id}>
			<Tuckaway.Actions side="start">
				<Tuckaway.Action onSelect={onArchive}>Archive</Tuckaway.Action>
			</Tuckaway.Actions>
			<Tuckaway.Content>{mail.subject}</Tuckaway.Content>
			<Tuckaway.Actions side="end">
				<Tuckaway.Action onSelect={onDelete} commit>
					Delete
				</Tuckaway.Action>
			</Tuckaway.Actions>
		</Tuckaway.Row>
	);
}

Style it#

tuckaway ships no CSS. Style the parts with your own classes, and the motion takes care of itself.

<Tuckaway.Content className="bg-white px-4 py-3">{/* ... */}</Tuckaway.Content>
<Tuckaway.Action className="bg-red-500 text-white" onSelect={remove} commit>
	Delete
</Tuckaway.Action>

Give Tuckaway.Content a background of its own. Don't set transform on it or width on Tuckaway.Actions, as those move every frame.