Flutter docs
Default skin

Transfer

Double column transfer choice box.

When to use

  • It is a select control essentially which can be used for selecting multiple items.
  • Transfer can display more information for items and take up more space.

Transfer the elements between two columns in an intuitive and efficient way.

One or more elements can be selected from either column, one click on the proper direction button, and the transfer is done. The left column is considered the source and the right column is considered the target. As you can see, these names are reflected in the API.

Notice: Transfer is a controlled component, uncontrolled mode is not supported.

Examples

Basic

The most basic usage of Transfer involves providing the source data and target keys arrays, plus the rendering and some callback functions.

One Way

Use oneWay to make Transfer the one way style.

Search

Transfer with a search box.

Advanced

Advanced Usage of Transfer. You can customize the labels of the transfer buttons, the width and height of the columns, and what should be displayed in the footer.

Custom datasource

Customize each Transfer Item, allowing you to render a complex datasource.

Custom Actions

You can customize operations with the actions prop. This example demonstrates how to customize actions, including handling disabled and loading states. When actions is an array of strings, it will use the default Button component and set the strings as button text. When actions is an array of React elements, it will use these elements directly as action buttons, allowing you to use custom button components, such as buttons with loading state in this example. Note: 1. When using custom buttons, the Transfer component will automatically handle the button's disabled state and click events. 2. You can add a disabled property to your custom button to control its disabled state. 3. You can add an onClick event handler to your custom button, which will be merged with the Transfer component's internal handler.

Pagination

Store a large amount of items with pagination.

Table Transfer

Customize the render list with a Table component.

Tree Transfer

Customize the render list with a Tree component.

Status

Add status to Transfer with status, which could be error or warning.

Custom semantic dom styling

You can customize the semantic dom style of Transfers by passing objects/functions through classNames and styles.

API

Transfer are exported from @ceebee/ui/client.

Transfer

PropertyDescriptionTypeDefaultVersion
actionsA set of operations that are sorted from top to bottom. When an array of strings is provided, default buttons will be used; when an array of ReactNode is provided, custom elements will be usedReactNode\[]\[>, <]6.0.0
classNamesCustomize class for each semantic structure inside the component. Supports object or function.Record<SemanticDOM, string> | (info: { props })=> Record<SemanticDOM, string>-6.0.0
dataSourceUsed for setting the source data. The elements that are part of this array will be present the left column. Except the elements whose keys are included in targetKeys propRecordType extends TransferItem = TransferItem\[]\[]—
disabledWhether disabled transferbooleanfalse—
selectionsIconcustom dropdown iconReact.ReactNode—5.8.0
filterOptionA function to determine whether an item should show in search result list, only works when searching, (add direction support since 5.9.0+)(inputValue, option, direction: left | right): boolean-—
footerA function used for rendering the footer(props, { direction }) => ReactNode-direction: 4.17.0
listStyleA custom CSS style used for rendering the transfer columns. Use styles.section insteadobject | ({direction: left | right}) => object-—
localeThe i18n text including filter, empty text, item unit, etc{ itemUnit: string; itemsUnit: string; searchPlaceholder: string; notFoundContent: ReactNode | ReactNode[]; }{ itemUnit: item, itemsUnit: items, notFoundContent: The list is empty, searchPlaceholder: Search here }—
oneWayDisplay as single direction stylebooleanfalse4.3.0
operationsA set of operations that are sorted from top to bottom. Use actions instead.string\[]\[>, <]—
operationStyleA custom CSS style used for rendering the operations column. Use styles.actions instead.object-—
paginationUse pagination. Not work in render propsboolean | { pageSize: number, simple: boolean, showSizeChanger?: boolean, showLessItems?: boolean }false4.3.0
renderThe function to generate the item shown on a column. Based on an record (element of the dataSource array), this function should return a React element which is generated from that record. Also, it can return a plain object with value and label, label is a React element and value is for title(record) => ReactNode-—
selectAllLabelsA set of customized labels for select all checkboxes on the header(ReactNode | (info: { selectedCount: number, totalCount: number }) => ReactNode)\[]-—
selectedKeysA set of keys of selected itemsstring\[] | number\[]\[]—
showSearchIf included, a search box is shown on each columnboolean | { placeholder:string,defaultValue:string }false—
showSelectAllShow select all checkbox on the headerbooleantrue—
statusSet validation status'error' | 'warning'-4.19.0
stylesCustomize inline style for each semantic structure inside the component. Supports object or function.Record<SemanticDOM, CSSProperties> | (info: { props })=> Record<SemanticDOM, CSSProperties>-6.0.0
targetKeysA set of keys of elements that are listed on the right columnstring\[] | number\[]\[]—
titlesA set of titles that are sorted from left to rightReactNode\[]-—
onChangeA callback function that is executed when the transfer between columns is complete(targetKeys, direction, moveKeys): void-—
onScrollA callback function which is executed when scroll options list(direction, event): void-—
onSearchA callback function which is executed when search field are changed(direction: left | right, value: string): void-—
onSelectChangeA callback function which is executed when selected items are changed(sourceSelectedKeys, targetSelectedKeys): void-—

Render Props

PropertyDescriptionTypeDefaultVersion
directionList render directionleft | right——
disabledDisable list or notboolean——
filteredItemsFiltered itemsRecordType\[]——
selectedKeysSelected itemsstring\[] | number\[]——
onItemSelectSelect item(key: string | number, selected: boolean)——
onItemSelectAllSelect a group of items(keys: string\[] | number\[], selected: boolean)——