Transfer list
Transfer list component to move items between two lists, with search, check all and keyboard support.
How to use it
Run npx @blossomui/react add transfer-list, or copy src/components/UI/TransferList/TransferList.tsx into your React project and import it.
import { TransferList } from './components/ui/TransferList'Props
TransferItem
| Prop | Type | Description |
|---|---|---|
| id (required) | string | |
| label (required) | string | |
| disabled | boolean |
TransferListLabels
| Prop | Type | Description |
|---|---|---|
| available (required) | string | Title of the list of items that were not chosen. |
| selected (required) | string | Title of the list of chosen items. |
| moveRight (required) | string | Accessible name of the button that moves the checked items to the chosen list. |
| moveLeft (required) | string | Accessible name of the button that moves the checked items back. |
| moveAllRight (required) | string | |
| moveAllLeft (required) | string | |
| search (required) | string | |
| empty (required) | string | Text of a list without items. |
| count (required) | (checked: number, total: number) => string | Text under the title of each list, for example "2 of 5 selected". |
TransferListProps
| Prop | Type | Description |
|---|---|---|
| labels | Partial<TransferListLabels> | Texts of the component. Pass only the ones you want to change, for example to translate it. |
| items (required) | TransferItem[] | Every item, in both lists. |
| value | string[] | Controlled ids of the chosen items. Use together with `onChange`. |
| defaultValue | string[] | Ids of the chosen items when the component is not controlled. |
| onChange | (value: string[]) => void | |
| searchable | boolean | Show a search field over each list. |
| color | string | Accent color of the checks: any CSS color. Without it the component uses `--blossom-accent`. |
| height | number | Height of each list in pixels. |
| className | string |