TransferList

Two lists and arrows between them. Tick items, press an arrow, and they fly across while both close the gap. Data.

Open playground
Permissions4
Granted1

About

TransferList is a React component in the Data category of smoui. It is typed, ships no stylesheet, follows your theme through CSS variables, and honors prefers-reduced-motion. Import it with import { TransferList } from "@ashutoshswamy/smoui" and set items, defaultChosen, availableTitle.

Install

Terminal
npm i @ashutoshswamy/smoui

Usage

TSX
import { TransferList } from "@ashutoshswamy/smoui";

<TransferList items={[{ id: "a", label: "Read" }, { id: "b", label: "Write" }]} defaultChosen={["b"]} onChange={(ids) => setGranted(ids)} />

Props 3

items

Everything that can move.

{ id; label }[]
defaultChosen / onChange

Start in the right list; called after each move.

string[] / (ids) => void
availableTitle / chosenTitle

List headings.

stringdefault "Available" / "Chosen"