Transfer List
Move items between two lists with selection, buttons, and drag-and-drop.
Choices
0/8 selected • 8/8Chosen
0/0 selected • 0/0tsx
import { TransferList, type TransferListItem } from "@/components/ui/transfer-list"
const items: TransferListItem[] = Array.from({ length: 8 }, (_, i) => ({ id: String(i + 1), label: "List item " + (i + 1),}))
export function Demo() { return ( <TransferList items={items} enableSearch showCounts listHeight={240} /> )}
Installation
CLI
bash
npx fivui add transfer-list
Manual
Copy and paste the following code into your project.
components/ui/transfer-list.tsx
// See local file for full source; snippet shown in docs page. Import from "@/components/ui/transfer-list".
Usage
tsx
import { TransferList } from "@/components/ui/transfer-list"
tsx
<TransferList items={[{ id: '1', label: 'Item 1' }]} />
Examples
Controlled
Source
0/2 selected • 2/2Target
0/2 selected • 2/2Left: [a, b] • Right: [c, d]
tsx
function DemoControlled() { const items = [ { id: 'a', label: 'Alpha' }, { id: 'b', label: 'Bravo' }, { id: 'c', label: 'Charlie' }, { id: 'd', label: 'Delta' }, ] const [leftIds, setLeftIds] = React.useState(['a', 'b']) const [rightIds, setRightIds] = React.useState(['c', 'd']) return ( <TransferList items={items} leftIds={leftIds} rightIds={rightIds} onChange={({ leftIds: l, rightIds: r }) => { setLeftIds(l); setRightIds(r) }} /> )}
Search and Custom Render
Team Members
Select members to invite.
Choices
0/4 selected • 4/4Chosen
0/0 selected • 0/0API Reference
Prop | Type | Default | Description |
---|---|---|---|
items | TransferListItem[] | - | All items that can be moved between lists. |
leftIds/rightIds | string[] | - | Controlled distribution. Provide both with onChange. |
defaultLeftIds/defaultRightIds | string[] | left: all items, right: [] | Uncontrolled initial placement. |
enableSearch | boolean | false | Show search inputs for filtering. |
showControlButtons | boolean | true | Show middle move buttons. |
allowDragAndDrop | boolean | true | Allow dragging items between lists. |
renderItem | (item) => ReactNode | item.label | Customize how items are rendered. |