Selection
Layout
CascadeSelect
A dropdown for picking a path through nested options, one level at a time. Use it for categories or places that branch into smaller ones.
Validating a form? vael-form wires this up with a schemaInstall
import { CascadeSelect } from 'vael-ui'Playground
Project files
chip
undefined
Placement, behaviour and animation
bottom
start
Usage
<script setup lang="ts">
import { ref } from 'vue'
import { CascadeSelect } from 'vael-ui'
const items = [
{ label: 'src', value: 'src', children: [
{ label: 'App.vue', value: 'src/App.vue' },
{ label: 'main.ts', value: 'src/main.ts' },
] },
{ label: 'README.md', value: 'README.md' },
]
const value = ref<V>()
const open = ref(false)
</script>
<template>
<CascadeSelect
placeholder="Choose an option"
aria-label="Project files"
:items="items"
v-model="value"
v-model:open="open"
/>
</template>Motion New
CascadeSelect's menu, like Menu's. chips moves the chips; valueSwap: false shows a picked value without its crossfade.
<CascadeSelect
:motion="{
initial: { panel: { opacity: 0, y: 8, scale: 0.98 } },
spring: { damping: 0.85, response: 0.35 },
}"
/>| Name | Type | Description |
|---|---|---|
initialexit | positionerpanel | Sets where each part comes in from and leaves to: any CSS property, plus x, y and blur. A plain number is px, or degrees for rotate. |
enterleave | (parts, context) => animation | Animates the parts with GSAP, motion or element.animate(). Return the animation and the component waits for it, and stops it if interrupted. |
morphlinkedexitOrder | 'trigger' | Record<string, LinkedMotion> | 'reverse' | morph: 'trigger' grows it out of the element that opened it. linked moves other elements with it, such as the page receding behind it. exitOrder: 'reverse' closes its children first. |
chips | ChipsMotion | A select's chips (multiple): values or hooks for chip, and the list's stagger and leaving. |
springdurationeasing | { damping, response } | number | string | Times all of it: a spring, or a duration in ms with an easing. Never both. |
false | boolean | Turns its motion off, for an animation of your own on its exposed elements. |
Accessibility
Follows the Menu Button pattern from the WAI-ARIA Authoring Practices Guide.
| Key | Action |
|---|---|
| ArrowDownArrowUpEnterSpace | Opens the menu from the trigger. |
| ArrowDownArrowUp | Moves focus to the next or previous option in the level, wrapping at the ends. |
| HomeEnd | Moves focus to the first or last option in the level. |
| ArrowRight | Opens the next level of a parent option and focuses its first option. |
| ArrowLeft | Closes the current level and returns focus to its parent option. |
| EnterSpace | Selects the focused option, or opens the next level of a parent option. |
| A letter | Moves focus to the next option whose label starts with the typed letters. |
| BackspaceDelete | Removes the last chip from the focused trigger, with multiple. |
| Escape | Closes the innermost open level. |
- The trigger is a menu button:
role="button"witharia-haspopup="menu",aria-expandedandaria-controls, read as its label followed by the value. Chip remove buttons inside it are pointer only, and the clear button is a Tab stop. - Each level is a
role="menu"named by what opened it. Options aremenuitems, ormenuitemcheckboxes witharia-checkedinmultiple; parent options addaria-haspopupandaria-expanded. A single pick closes the menu;multiplekeeps it open. - Focus moves into the menu on open, to the selected option’s path or the first option, and returns to the trigger on close or clear. With
filter, focus starts in the search box: ArrowDown moves to the results, Enter picks the first one, and typing or Backspace on a result goes back to the search box. - Inside a
Field, the label names the trigger. Without one, passaria-labeloraria-labelledby; the value is still read after it. Right to left, ArrowLeft and ArrowRight swap, and levels open to the left.