MultiCascader
The MultiCascader
component is used to select multiple values from cascading options.
Import
import { MultiCascader } from 'rsuite';
Examples
Default
Appearance
Size
Cascade
Default value
Controlled
Block
Placement
Tip: When set to
auto*
, try to scroll the page, or change the browser size, it will automatically appear in the right place.
Custom options
Disabled and read only
Uncheckable
Async
Container and prevent overflow
Accessibility
ARIA properties
- MultiCascader has role
combobox
. - Has the
aria-haspopup="tree"
attribute to indicate that the combobox has a popup tree. - Has the
aria-expanded
attribute to indicate whether the tree is open or not. - Has the
aria-controls
attribute to indicate the ID of the tree element. - Has the
aria-activedescendant
attribute to indicate the ID of the focused tree node. - When
label
is set, thearia-labelledby
attribute is added to the combobox element and the tree element and is set to the value of theid
attribute oflabel
. - The tree has the
aria-multiselectable=true
attribute to indicate that the tree is multi-selectable.
Keyboard interactions
- ↓ - Move focus to the next tree node.
- ↑ - Move focus to the previous tree node.
- → - Expand the focused tree node if it is collapsed.
- ← - Collapse the focused tree node if it is expanded.
- Enter - Select the focused tree node.
- Esc - Close the tree.
Props
<MultiCascader>
Property | Type(Default) |
Description |
---|---|---|
appearance | 'default' | 'subtle' ('default') |
Set picker appearence |
block | boolean | Blocking an entire row |
caretAs | ElementType | Custom component for the caret icon |
cascade | boolean (true) |
whether cascade select |
childrenKey | string ('children') |
Set children key in data |
classPrefix | string ('picker') |
The prefix of the component CSS class |
cleanable | boolean (true) |
Whether the selected value can be cleared |
container | HTMLElement | (() => HTMLElement) | Sets the rendering container |
countable | boolean (true) |
Can count selected options |
data * | ItemDataType[] | The data of component |
defaultOpen | boolean | Default value of open property |
defaultValue | string | Default values of the selected items |
disabled | boolean | Disabled component |
disabledItemValues | string | Disabled items |
height | number (320) |
The height of Dropdown |
inline | boolean | The menu is displayed directly when the component is initialized |
boolean | ⚠️[Deprecated] Use the <MultiCascadeTree> component instead |
|
labelKey | string ('label') |
Set label key in data |
loading | boolean (false) |
Whether to display a loading state indicator |
locale | PickerLocaleType | Locale text |
string | ⚠️[Deprecated] Use popupClassName instead |
|
number | ⚠️[Deprecated] Use columnHeight instead |
|
CSSProperties | ⚠️[Deprecated] Use popupStyle instead |
|
number | ⚠️[Deprecated] Use columnWidth instead |
|
onChange | (value: string, event) => void | Callback fired when value change |
onCheck | (value: string, item: ItemDataType, checked: boolean, event) => void; | Called after the checkbox state changes |
onClean | (event) => void | Callback fired when value clean |
onClose | () => void | Callback fired when close component |
onEnter | () => void | Callback fired before the overlay transitions in |
onEntered | () => void | Callback fired after the overlay finishes transitioning in |
onEntering | () => void | Callback fired as the overlay begins to transition in |
onExit | () => void | Callback fired right before the overlay transitions out |
onExited | () => void | Callback fired after the overlay finishes transitioning out |
onExiting | () => void | Callback fired as the overlay begins to transition out |
onOpen | () => void | Callback fired when open component |
onSearch | (searchKeyword:string, event) => void | callback function for Search |
onSelect | (item: ItemDataType, selectedPaths: ItemDataType[], event) => void | Callback fired when item is selected |
open | boolean | Whether open the component |
placeholder | ReactNode ('Select') |
Setting placeholders |
placement | Placement('bottomStart') |
The placement of component |
popupClassName | string | Custom class name for the popup |
popupStyle | CSSProperties | Custom style for the popup |
preventOverflow | boolean | Prevent floating element overflow |
(node: ReactNode, column: { items, parentItem, layer}) => ReactNode | ⚠️[Deprecated] Use renderColumn instead |
|
renderColumn | (childNodes: ReactNode, column: { items, parentItem, layer}) => ReactNode | Customizing the Rendering Menu list |
renderExtraFooter | () => ReactNode | custom render extra footer |
(children: object[], menu:ReactNode, parentNode?: object, layer?: number) => ReactNode | ⚠️[Deprecated] Use renderColumn instead |
|
(label:ReactNode, item: ItemDataType) => ReactNode | ⚠️[Deprecated] Use renderTreeNode instead |
|
(node: ReactNode, item: ItemDataType) => ReactNode | ⚠️[Deprecated] Use renderTreeNode instead |
|
renderTreeNode | (node: ReactNode, item: ItemDataType) => ReactNode | Custom render menu items |
renderValue | (value:string,selectedItems: ItemDataType[],selectedElement:ReactNode) => ReactNode | Custom render selected items |
searchable | boolean (true) |
Whether you can search for options. |
size | 'lg' | 'md' | 'sm' | 'xs' ('md') |
A picker can have different sizes |
toggleAs | ElementType ('a') |
You can use a custom element for this component |
uncheckableItemValues | string | Set the option value for the check box not to be rendered |
value | string | Specifies the values of the selected items(Controlled) |
valueKey | string ('value') |
Set value key in data |
ts:ItemDataType
interface ItemDataType<V> {
/** The value of the option corresponds to the `valueKey` in the data. **/
value: V;
/** The content displayed by the option corresponds to the `labelKey` in the data. **/
label: ReactNode;
/**
* The data of the child option corresponds to the `childrenKey` in the data.
* Properties owned by tree structure components, such as TreePicker, Cascader.
*/
children?: ItemDataType<V>[];
/**
* Properties of grouping functional components, such as CheckPicker, InputPicker
*/
groupBy?: string;
/**
* The children under the current node are loading.
* Used for components that have cascading relationships and lazy loading of children. E.g. Cascader, MultiCascader
*/
loading?: boolean;
}
ts:Placement
type Placement = 'bottomStart' | 'topStart' | 'autoVerticalStart';
\