UIComponentsReact
Two lists side by side, the available options and the chosen ones, with buttons that move the selected options from one to the other.
Built on the headless Transfer List.See its API in Docs
Rendered by React 19.3.1
Installation
npx shadcn@4.23.0 add https://hamur.dev/r/react/transfer-list.jsonIt also adds utils, button. The app needs its setup first: Installation.
Usage
Put a TransferListSource and a TransferListTarget inside TransferList, each holding a TransferListLabel, an optional TransferListFilter, a TransferListList and a TransferListEmpty. Give TransferList every option in items and the chosen ones in value or defaultValue; the Source shows the rest. A List renders one TransferListItem per option it shows, from a function child (Vue: the item slot; Svelte: the children snippet; Angular: @for over the List's shown()), each holding a TransferListItemText and a TransferListItemIndicator with keepMounted, so an unselected option keeps its empty box. Between the sides, a TransferListActions column holds one TransferListAction per move: moveAllToTarget, moveToTarget, moveToSource, moveAllToSource, and with reorderable, moveUp and moveDown. An Action without content shows lucide's chevrons for its move and is named from labels with the Label of the List it moves to. Give TransferList a name (aria-label, aria-labelledby or a Field label). The keys, the double click, the drag, the announcements and the form value come from the headless Transfer List.
import {
TransferList,
TransferListAction,
TransferListActions,
TransferListEmpty,
TransferListFilter,
TransferListItem,
TransferListItemIndicator,
TransferListItemText,
TransferListLabel,
TransferListList,
TransferListSource,
TransferListTarget,
} from '@/components/ui/transfer-list'Examples
Default
Car upgrades: Leather seats, Front seat warmers and Sunroof available, Rear bike rack chosen, Sunroof selected.
The Lists are Listbox's box and options, multi-select. A selected option takes a tinted ground and a filled box with a check, not colour alone (WCAG 1.4.1). Each List's edge and the filled box are at least 3:1 against what is around them in every preset theme, light and dark (WCAG 1.4.11). Options are 32 pixels tall and the Actions 32 by 32 (WCAG 2.5.8); the options, an empty List, the Filter and the Actions show the focus ring (WCAG 2.4.7). An Action whose move does not apply stays focusable and is drawn at half opacity. Side by side from the sm breakpoint, the Lists stack under it with the Actions in a row between them, their chevrons turned to point down and up; in a right-to-left page the chevrons mirror. TransferListActions is a layout column of this item only, with no role. This item takes Base UI's component ID as its slug and one name per Base UI part.
API reference
The styled parts pass every prop to the headless part they wrap and add classes. The props, data attributes and keyboard are on Transfer List's API reference.