TransferList
Usage
Native scrollbars
By default, TransferList uses ScrollArea to render list.
If you want to use native scrollbars instead, set div
as a list component:
Custom item component
To customize item appearance, replace default item component:
- Add additional props to data
- Build a component which will consume your data object
- Provide custom component via
itemComponent
prop - Customize search with
filter
function
Initial selection
Set initial selected items with initialSelection
prop.
Value should be a tuple of two arrays which contain values from data:
Controlled search
You can optionally control the search inputs by providing searchValues
and onSearch
props. searchValues
should
be a tuple of two strings, one for each list:
Transferring only found items
By default, TransferList transfers all items when you click the transferAll
button.
By setting the transferAllMatchingFilter
prop to true
, TransferList will only transfer the items that match the current filter.
Empty search VS empty list
You can specify a placeholder
prop, which will be used in place of the nothingFound
when a list is completely empty,
and no query is set.
Custom wording for each list
placeholder
, nothingFound
and searchPlaceholder
props can take a tuple of values instead of a single value to
customize each list independently.
Grouping items
Custom control icons
Responsive styles
Set breakpoint
prop to specify at which breakpoint TransferList will collapse to 1 column:
TransferList component props
Name | Type | Description |
---|---|---|
breakpoint | number | "xs" | "sm" | "md" | "lg" | "xl" | Breakpoint at which list will collapse to single column layout |
filter | (query: string, item: TransferListItem) => boolean | Function to filter search results |
initialSelection | Selection | Initial items selection |
itemComponent | TransferListItemComponent | Custom item component |
limit | number | Limit amount of items showed at a time |
listComponent | any | Change list component, can be used to add custom scrollbars |
listHeight | number | List items height |
nothingFound | ReactNode | [ReactNode, ReactNode] | Nothing found message |
onChange * | (value: TransferListData) => void | Called when value changes |
onSearch | (value: [string, string]) => void | Called when one of the search queries changes |
placeholder | ReactNode | [ReactNode, ReactNode] | Displayed when a list is empty and there is no search query |
radius | number | "xs" | "sm" | "md" | "lg" | "xl" | Predefined border-radius value from theme.radius or number for border-radius in px |
searchPlaceholder | string | [string, string] | Search fields placeholder |
searchValues | [string, string] | Controlled search queries |
showTransferAll | boolean | Whether to hide the transfer all button |
titles | [string, string] | Lists titles |
transferAllIcon | FunctionComponent<{ reversed: boolean; }> | Change icon used for the transfer all control |
transferAllMatchingFilter | boolean | Whether to transfer only items matching {@link filter} when clicking the transfer all control |
transferIcon | FunctionComponent<{ reversed: boolean; }> | Change icon used for the transfer selected control |
value * | TransferListData | Current value |
TransferList component Styles API
Name | Static selector | Description |
---|---|---|
transferList | .mantine-TransferList-transferList | One of list |
transferListTitle | .mantine-TransferList-transferListTitle | Title |
transferListBody | .mantine-TransferList-transferListBody | Contains header and items list |
transferListHeader | .mantine-TransferList-transferListHeader | Contains search and controls |
transferListItems | .mantine-TransferList-transferListItems | Items container |
transferListItem | .mantine-TransferList-transferListItem | List item |
transferListItemHovered | .mantine-TransferList-transferListItemHovered | List item modifier with hovered state |
transferListSearch | .mantine-TransferList-transferListSearch | Search field |
transferListControl | .mantine-TransferList-transferListControl | Controls to move items |
separator | .mantine-TransferList-separator | Divider wrapper |
separatorLabel | .mantine-TransferList-separatorLabel | Separator Label |