Skip to main content

rc-transfer-list

Transfer list that enhances a native <select multiple> into available and selected panes.

The component renders two listboxes and transfer/reorder actions in between. Available options are on the left, and selected options appear on the right. It is an older enterprise/admin UI pattern, but solves the specific problem of multiple selection within a large amount of options.

Modern use cases include user and permissions management tasks, multi-select for columns / fields / filters and list re-ordering.

Use compact when the surrounding layout should stack the available list, actions, and selected list in one column. The component does not switch layout automatically at viewport breakpoints.

Package
@rcarls/rc-transfer-list
Element
<rc-transfer-list>
Native dependency
Requires a native select child
State model
Native select selection
Main events
rc-transfer-list-change

Installation

npm install @rcarls/rc-transfer-list
import '@rcarls/rc-transfer-list/define';

Live demo

Theming

The default demo mode shows the component without a package theme. Use the shared preview controls on this page to compare inherited, light, and dark color schemes or to apply the optional Material theme only inside the demo frames.

API

Properties

PropertyMarkupTypeDefaultDescription
multiplemultiplebooleanfalseEnable multi-selection in both lists.
compactcompactbooleanfalseStack the panels and action toolbar into a compact one-column layout.
availableLabelavailable-labelstring'Available'Visible label for the available list.
selectedLabelselected-labelstring'Selected'Visible label for the selected list.
availableJS property onlyListboxOption[]Not specifiedAvailable/left-hand options derived from unselected `<option>` elements. Setting this property replaces all unselected options in the backing `<select>`. Items whose values already appear in the selected list are skipped to prevent duplicate option values.
selectedJS property onlyListboxOption[]Not specifiedSelected/right-hand options derived from selected `<option>` elements. Setting this property replaces all selected options in the backing `<select>`. Unselected options are left unchanged.
defaultSelectedJS property onlyListboxOption[] | undefinedNot specifiedInitial uncontrolled selected list. Applied before any `selected` write from the host.

Methods

MethodDescription
addSelected()Adds the highlighted available options to the selected list.
addAll()Adds every available option to the selected list.
removeSelected()Removes the highlighted right-hand options from the selected list.
clearSelected()Clears the selected/right-hand list.
moveSelected(delta: number)Moves highlighted right-hand options by `delta` rows (-1 = up, 1 = down).

Events

EventDetail typeDescription
rc-transfer-list-changeCustomEventFires when the selected/right-hand list changes.

Slots

No slots are documented in the custom elements manifest.

CSS Custom Properties

PropertyDefaultDescription
--rc-transfer-list-gapvar(--rc-control-gap)Gap between panels and the action toolbar
--rc-transfer-list-panel-gapvar(--rc-control-gap)Gap between a panel label and its listbox
--rc-transfer-list-listbox-min-block-size10remMinimum block size for each listbox
--rc-transfer-list-listbox-bordervar(--rc-border)Border around each listbox
--rc-transfer-list-option-gapvar(--rc-item-gap)Gap between option adornments and labels
--rc-transfer-list-option-padding-blockvar(--rc-item-padding-block)Block padding for option rows
--rc-transfer-list-option-padding-inlinevar(--rc-item-padding-inline)Inline padding for option rows
--rc-transfer-list-option-selected-bgvar(--rc-highlight)Selected option background
--rc-transfer-list-option-selected-colorvar(--rc-highlight-text)Selected option foreground

CSS Parts

PartDescription
rootRoot layout wrapper. Reflects data-can-move-up/down.
panelShared list panel surface.
available-panelAvailable/left panel. Reflects data-empty and data-has-selection.
selected-panelSelected/right panel. Reflects data-empty and data-has-selection.
actionsTransfer action toolbar.
buttonShared action button surface.