Web · Components
Cascader
Cascading picker: leveled choices like province → district → neighbourhood or category → subcategory.
4 exports
Live example
Preview
Code
Events
- Events appear here when you interact with the preview.
Import
Cascading picker: leveled choices like province → district → neighbourhood or category → subcategory. On desktop columns open side by side; on mobile a single column advances level by level and "Back" returns.
- Value: a path array (
["istanbul", "kadikoy"]); "Istanbul / Kadıköy" in the box. By default only the last level is selectable; intermediate levels too withchangeOnSelect. - Loading:
hasChildrenoptions are fetched withloadChildrenwhen opened (e.g. districts from the server when a province is selected); a spinner shows in the row while loading, and "Try again" on error. - Search:
searchsearches all paths, Turkish case-insensitive. - Keyboard: ↑/↓ move within a column, → or Enter opens the child column, ← returns to the parent column, Enter selects a leaf, Esc closes.
- Form: with
namethe path is submitted as"istanbul/kadikoy";requiredworks.
For tree-shaped selection (multiple selection, search, drag) use TreeSelect.
Examples
CascaderOption
interfaceAn option inside a Cascader.
| Name | Type | Description |
|---|---|---|
value | string | Unique value at this level; the path is made of these values. |
label? | string | Display name. Defaults to value. |
icon? | IconProp | Icon at the start of the name. |
description? | ReactNode | Small description below the name. |
children? | readonly CascaderOption[] | Child options. |
hasChildren? | boolean | Child options aren't loaded yet but exist; requested with loadChildren when opened. false means it is a leaf. |
disabled? | boolean | Not selectable. |
CascaderClassNames
interfaceClasses that can be given to the inner parts of Cascader.
| Name | Type | Description |
|---|---|---|
trigger? | string | Trigger button. |
content? | string | The open panel. |
column? | string | Each column. |
CascaderProps
interfaceProps of the Cascader component.
| Name | Type | Default | Description |
|---|---|---|---|
options | readonly CascaderOption[] | Option tree (e.g. province → district → neighbourhood). See CascaderOption. | |
value? | readonly string[] | Selected path in controlled use (["istanbul", "kadikoy"]); [] for none. | |
defaultValue? | readonly string[] | Initial path in uncontrolled use. | |
onValueChange? | (path: string[], options: CascaderOption[]) => void | Called with the path and the options along it when the selection changes ([] when cleared). | |
loadChildren? | (option: CascaderOption, path: readonly CascaderOption[], signal: AbortSignal) => Promise<readonly CascaderOption[]> | Fetches the children of a hasChildren option when it opens (e.g. districts when a province is selected). The result is cached; on error "Try again" appears. | |
changeOnSelect? | boolean | false | Can intermediate levels be selected too? When true, "Istanbul" can also be selected on its own; a click selects it and opens the child column, and the panel stays open. |
expandTrigger? | "click" | "hover" | "click" | Open the child column on hover ("hover") or on click? |
search? | boolean | false | Search box: typing searches all paths ("kadı" → "Istanbul / Kadıköy"). Searches only loaded options. |
separator? | string | " / " | Separator of the path in the box. |
renderValue? | (options: CascaderOption[]) => ReactNode | How the path appears in the box; names are joined with the separator when omitted. | |
placeholder? | ReactNode | "Seçiniz" | Text shown when nothing is selected. |
icon? | IconProp | Icon at the start of the box. | |
clearable? | boolean | false | × button that clears the selection. |
variant? | FieldVariant | CustomVariant<"field"> | Appearance. See FieldVariant. | |
effect? | EffectProp | Effect or effects of the field box (e.g. "glow", ["lift", "beam"]). The accent color is the focus color (--ui-field-focus). Defaults to UIProvider appearance.defaults.field.effect. See BuiltinEffect. | |
name? | string | Form field name. The path is joined with valueSeparator and submitted ("istanbul/kadikoy"). | |
valueSeparator? | string | "/" | Separator of the path in the form. |
form? | string | Id of the form the field belongs to. | |
required? | boolean | The form can't be submitted without a selection. | |
disabled? | boolean | Disabled. | |
id? | string | Id of the trigger button. | |
autoFocus? | boolean | Focused when the page opens. | |
open? | boolean | Whether the panel is open in controlled use. | |
defaultOpen? | boolean | false | Open initially in uncontrolled use? |
onOpenChange? | (open: boolean) => void | When the panel opens or closes. | |
tooltip? | TooltipProp | Tooltip on hovering the box. See TooltipProp. | |
className? | string | Classes added to the container. | |
classNames? | CascaderClassNames | Classes added to the inner parts. | |
aria-label? | string | Screen reader name. | |
aria-labelledby? | string | Id of the element naming the box. | |
aria-describedby? | string | Id of the element describing the box. | |
aria-invalid? | boolean | "true" | "false" | Show as invalid. |