Cascader
A field that opens columns of nested choices, such as governorate, district and area, and fills in the whole path.
Preview
Mirrored is the same English content laid out right to left: it separates a mirroring bug from a translation one.
PreviewCode
EnglishMirroredArabic
LTR →
Installation
Add the component
npx ritla add cascaderAlso works with shadcn:
npx shadcn@latest add @ritla/cascaderOr copy by hand
Installing by hand copies the component's source into your project. The source comes with a Ritla UI license, so the CLI is the short way to the same files.
Usage
import { Cascader } from "@/components/ui/cascader";<Cascader label="Delivery area" options={areas} onValueChange={setPath} />API reference
Cascader
| Prop | Type | Default | Description |
|---|---|---|---|
options | { value, label, children?, disabled? }[] | None | The tree; the last level has no children. |
value / defaultValue / onValueChange | string[] | None | The chosen path, a value per level. |
levelLabels | string[] | None | Names each column for screen readers. |
placeholder / separator | string | " / " | The text before a choice, and the separator between levels. |
label / required / helperText / error / disabled / name | … | None | As on the Select. |
Accessibility
Keyboard
Keys are written for left-to-right. In right-to-left the arrow keys swap: the one pointing toward the reading direction moves forward.
| Key | Action |
|---|---|
| EnterSpace | Opens the panel, opens the next column, and chooses on the last level. |
| ArrowDownArrowUp | Moves within a column. |
| ArrowRightArrowLeft | To the next or previous column. In Arabic, ArrowLeft goes to the next. |
| Escape | Closes the panel and returns focus to the field. |
ARIA
- Each column is a
listboxnamed by its level, and an open item carriesaria-expanded. - The field reads its label and the chosen path.
Arabic and RTL notes
Mirrors
- The first column sits on the right and the carets point left.
- The path in the field reads from the right: عمّان / وادي السير / خلدا.
Does not mirror
- The field's caret points down in both directions.
- Numerals
- It usually holds no numbers.
- Arabic typography
label-16in the field,label-14Medium in the columns.