Flutter docs
Default skin

Cascader

Cascade selection box.

When to use

  • When you need to select from a set of associated data set. Such as province/city/district, company level, things classification.
  • When selecting from a large data set, with multi-stage classifications separated for easy selection.
  • Chooses cascade items in one float layer for better user experience.

Examples

Basic

Cascade selection box for selecting province/city/district.

Custom trigger

Separate trigger button and result.

Disabled option

Disable option by specifying the disabled property in options.

Multiple

Select multiple options. Disable the checkbox by adding the disableCheckbox property and selecting a specific item. The style of the disable can be modified by the className.

Size

Cascade selection box of different sizes.

Search

Search and select options directly. Cascader[showSearch] doesn't support search on server.

Custom Field Names

Custom field names.

Custom dropdown

Customize the dropdown menu via popupRender.

Variants

Variants of Cascader, there are four variants: outlined, filled, borderless and underlined.

Custom semantic dom styling

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

Default value

Specifies default value by an array.

Hover

Hover to expand sub menu, click to select option.

Change on select

Allows the selection of only parent options.

ShowCheckedStrategy

Shows a selected item in a box using showCheckedStrategy.

Custom render

For instance, add an external link after the selected value.

Load Options Lazily

Load options lazily with loadData. Note: loadData cannot work with showSearch.

Prefix and Suffix

Use prefix to customize the prefix content, use suffixIcon to customize the selection box suffix icon, and use expandIcon to customize the current item expand icon.

Placement

You can manually specify the position of the popup via placement.

Status

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

Panel

Used for inline view case.

API

Cascader and its props are exported from @ceebee/ui/client.

Cascader

PropertyDescriptionTypeDefaultVersion
allowClearShow clear buttonboolean | { clearIcon?: ReactNode }true5.8.0: Support object type
autoClearSearchValueWhether the current search will be cleared on selecting an item. Only applies when multiple is truebooleantrue5.9.0
borderedWhether has border style, please use variant insteadbooleantrue-
changeOnSelectChange value on each selection if set to true, see above demo for detailsbooleanfalse—
classNamesCustomize class for each semantic structure inside the component. Supports object or function.Record<SemanticDOM, string> | (info: { props })=> Record<SemanticDOM, string>-—
defaultOpenInitial visible of cascader popupboolean-—
defaultValueInitial selected valuestring\[] | number\[]\[]—
disabledWhether disabled selectbooleanfalse—
displayRenderThe render function of displaying selected options(label, selectedOptions) => ReactNodelabel => label.join(/)multiple: 4.18.0
tagRenderCustom render function for tags in multiple mode(label: string, onClose: function, value: string) => ReactNode-—
popupClassNameThe additional className of popup overlay, use classNames.popup.root insteadstring-4.23.0
dropdownClassNameThe additional className of popup overlay, please use classNames.popup.root insteadstring--
dropdownRenderCustomize dropdown content, use popupRender instead(menus: ReactNode) => ReactNode-4.4.0
popupRenderCustomize dropdown content(menus: ReactNode) => ReactNode-—
dropdownStyleThe style of dropdown menu, use styles.popup.root insteadCSSProperties-—
expandIconCustomize the current item expand iconReactNode-4.4.0
expandTriggerexpand current item when click or hover, one of click hoverstringclick—
fieldNamesCustom field name for label and value and childrenobject{ label: label, value: value, children: children }—
getPopupContainerParent Node which the selector should be rendered to. Default to body. When position issues happen, try to modify it into scrollable content and position it relative. examplefunction(triggerNode)() => document.body—
loadDataTo load option lazily, and it cannot work with showSearch(selectedOptions) => void-—
loadingIconCustomize the loading iconReactNode-—
maxTagCountMax tag count to show. responsive will cost render performancenumber | responsive-4.17.0
maxTagPlaceholderPlaceholder for not showing tagsReactNode | function(omittedValues)-4.17.0
maxTagTextLengthMax tag text length to shownumber-4.17.0
notFoundContentSpecify content to show when no result matchesReactNodeNot Found—
openSet visible of cascader popupboolean-4.17.0
optionsThe data options of cascadeOption\[]-—
placeholderThe input placeholderstring-—
placementUse preset popup align config from builtinPlacementsbottomLeft bottomRight topLeft topRightbottomLeft4.17.0
prefixThe custom prefixReactNode-5.22.0
showArrowWhether to show the arrow icon, please use suffixIcon={null} insteadbooleantrue-
showSearchWhether show search input in single modeboolean | Objectfalse—
sizeThe input sizelarge | medium | smallmedium—
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>-—
suffixIconThe custom suffix iconReactNode-—
valueThe selected valuestring\[] | number\[]-—
variantVariants of selectoroutlined | borderless | filled | underlinedoutlined5.13.0 | underlined: 5.24.0
onChangeCallback when finishing cascader select(value, selectedOptions) => void-—
onClearCalled when clear() => void--
onDropdownVisibleChangeCallback when popup shown or hidden, use onOpenChange instead(value) => void-4.17.0
onOpenChangeCallback when popup shown or hidden(value) => void-—
onPopupVisibleChangeCallback when popup shown or hidden, please use onOpenChange instead(value) => void--
multipleSupport multiple or notboolean-4.17.0
removeIconThe custom remove iconReactNode-—
showCheckedStrategyThe way to show selected items in the box (only effective when multiple is true). Cascader.SHOW_CHILD: just show child treeNode. Cascader.SHOW_PARENT: just show parent treeNode (when all child treeNode under the parent treeNode are checked)Cascader.SHOW_PARENT | Cascader.SHOW_CHILDCascader.SHOW_PARENT4.20.0
searchValueSet search value, Need work with showSearchstring-4.17.0
onSearchThe callback function triggered when input changed(search: string) => void-4.17.0
dropdownMenuColumnStyleThe style of the drop-down menu column, use styles.popup.listItem insteadCSSProperties-—
popupMenuColumnStyleThe style of the drop-down menu column, use styles.popup.listItem insteadCSSProperties-—
optionRenderCustomize the rendering dropdown options(option: Option) => React.ReactNode-5.16.0

showSearch

PropertyDescriptionTypeDefaultVersion
autoClearSearchValueWhether the current search will be cleared on selecting an item. Only applies when multiple is truebooleantrue5.9.0
filterThe function will receive two arguments, inputValue and option, if the function returns true, the option will be included in the filtered set; Otherwise, it will be excludedfunction(inputValue, path): boolean-—
limitSet the count of filtered itemsnumber | false50—
matchInputWidthWhether the width of list matches input, (how it looks)booleantrue—
renderUsed to render filtered optionsfunction(inputValue, path): ReactNode-—
sortUsed to sort filtered optionsfunction(a, b, inputValue)-—
searchValueSet search value, Need work with showSearchstring-4.17.0
onSearchThe callback function triggered when input changed(search: string) => void-4.17.0
searchIconCustomize the search iconReactNode-6.3.0

Option

PropertyDescriptionTypeDefaultVersion
blur()Remove focus———
focus()Get focus———