Cascader

Cascader

Forms
Selection

Hierarchical cascading selection with multi-level navigation, search, and flexible interaction modes. Ideal for selecting from deeply nested category structures.

Preview

Click to navigate through hierarchical options

Selected: None

Variants

Different input styles

With Default Selection

Pre-selected hierarchical path

Hover Trigger

Expand menus on hover instead of click

Change on Select

Allow selection of intermediate levels, not just leaf nodes

Selected: None

Searchable Cascader

Search across all levels of the hierarchy

Custom Path Separator

Use custom separator for path display

Sizes

Different input sizes

Error State

Validation error display

Please select a location

Props

Cascader component API reference

PropTypeDefaultDescription
optionsCascaderOption[][]Hierarchical options
valuestring[][]Selected value path
onChange(value: string[], options: CascaderOption[]) => void—Callback when value changes
placeholderstring'Select...'Placeholder text
expandTrigger'click' | 'hover''click'How to expand menus
changeOnSelectbooleanfalseAllow selecting intermediate levels
showPathbooleantrueShow full path in input
separatorstring' / 'Path separator character
searchablebooleanfalseEnable search functionality
disabledbooleanfalseDisable the cascader
variant'default' | 'filled' | 'error''default'Input style variant
inputSize'sm' | 'md' | 'lg''md'Input size
labelstring—Label text
errorstring—Error message
helperTextstring—Helper text below input

CascaderOption Type

PropTypeDefaultDescription
value*string—Option value
label*string—Display label
childrenCascaderOption[]—Child options
disabledboolean—Disable this option

Usage

Import and implementation example

import { Cascader, CascaderOption } from '@/components/ui/cascader'
const options: CascaderOption[] = [
{
value: 'usa',
label: 'United States',
children: [
{
value: 'california',
label: 'California',
children: [
{ value: 'sf', label: 'San Francisco' },
{ value: 'la', label: 'Los Angeles' },
],
},
],
},
]
export default function Example() {
const [value, setValue] = useState<string[]>([])
return (
<Cascader
options={options}
value={value}
onChange={(val, opts) => {
setValue(val)
console.log('Selected options:', opts)
}}
placeholder="Select location"
label="Location"
expandTrigger="click"
changeOnSelect={false}
searchable={true}
/>
)
}
This block is self-contained (no UI component dependencies)

Features

Built-in functionality

  • Multi-level navigation: Navigate through deeply nested hierarchies
  • Click or hover trigger: Choose interaction mode for menu expansion
  • Intermediate selection: Option to select non-leaf nodes
  • Full-text search: Search across all levels of the hierarchy
  • Path display: Show full path or just the final selection
  • Custom separators: Customize path separator character
  • Clear button: One-click to clear selection
  • Keyboard navigation: Full keyboard support for accessibility

Accessibility

Accessibility considerations

ARIA Attributes

Trigger button has proper focus managementOptions are keyboard navigableSearch input has label association

Keyboard Navigation

KeyAction
TabFocus the trigger button
Enter / SpaceOpen dropdown or select option
EscapeClose the dropdown
Arrow keysNavigate between options

Notes

  • Selected path shown in input as readable text
  • Options highlight on hover/focus
  • Chevron indicates expandable options
  • Disabled options are visually distinct