Transfer
Forms
Selection
Dual-list selector for moving items between lists with search, select all, and bidirectional transfer support.
Preview
Simple dual-list transfer with search functionality
Available Items
8 itemsSelected Items
0 itemsNo items
With Initial Selection
Transfer component with pre-selected items
Source
6 itemsTarget
2 itemsWithout Search
Disable search functionality for simple transfers
All Team Members
6 itemsProject Team
0 itemsNo items
One-way Transfer
Only allow moving items from source to target
Available Skills
5 itemsRequired Skills
0 itemsNo items
Custom List Height
Adjust list height for different content amounts
Source
8 itemsTarget
0 itemsNo items
Props
Transfer component API reference
| Prop | Type | Default | Description |
|---|---|---|---|
dataSource | TransferItem[] | — | All available items |
targetKeys | string[] | — | Keys of selected items |
onChange | (keys: string[]) => void | — | Callback when selection changes |
titles | [string, string] | ['Source', 'Target'] | List titles |
searchable | boolean | true | Enable search |
oneWay | boolean | false | One-way transfer only |
listHeight | number | 300 | List height in pixels |
showSelectAll | boolean | true | Show select all checkbox |
TransferItem Type
interface TransferItem { key: string // Unique identifier title: string // Item display text description?: string // Optional description disabled?: boolean // Disable item selection}Usage
Import and implementation example
import { Transfer, TransferItem } from '@/components/ui/transfer'
export default function Example() { const [targetKeys, setTargetKeys] = useState<string[]>([])
const data: TransferItem[] = [ { key: '1', title: 'Item 1', description: 'Description' }, { key: '2', title: 'Item 2' }, { key: '3', title: 'Disabled Item', disabled: true }, ]
return ( <> {/* Basic usage */} <Transfer dataSource={data} targetKeys={targetKeys} onChange={setTargetKeys} titles={['Available', 'Selected']} />
{/* Without search */} <Transfer dataSource={data} targetKeys={targetKeys} onChange={setTargetKeys} searchable={false} />
{/* One-way transfer */} <Transfer dataSource={data} targetKeys={targetKeys} onChange={setTargetKeys} oneWay={true} />
{/* Custom height */} <Transfer dataSource={data} targetKeys={targetKeys} onChange={setTargetKeys} listHeight={200} /> </> )}Features
Built-in functionality
- Dual-list interface: Source and target lists side by side
- Search filtering: Filter items by title
- Select all: Bulk select all visible items
- Bidirectional transfer: Move items in both directions
- One-way mode: Restrict to source-to-target only
- Disabled items: Prevent specific items from being moved
- Custom titles: Label each list appropriately
- Dark mode: Full dark mode support
Accessibility
Accessibility considerations
ARIA Attributes
Lists use proper role="listbox"Items use role="option"Selected state communicated via aria-selectedKeyboard Navigation
| Key | Action |
|---|---|
| Tab | Navigate between controls |
| Space | Select/deselect item |
| Enter | Trigger transfer buttons |
| Arrow Keys | Navigate items in list |
Notes
- Transfer buttons indicate direction
- Search input is properly labeled
- Selection count shown in header
- Disabled items are skipped in navigation