Fine-tune light, shadows, borders, neumorphic
Light and shadows
Borders
Neumorphic
Forms Form-associated

Cascader <pm-cascader>

Cascader: choose one item from nested lists, one column per level (country, region, city; category, subcategory).

Full screen

Props

<script type="module"> import '@prismora/css'; import '@prismora/elements/cascader'; </script> <pm-cascader label="Location" name="city" value="munich" style="inline-size: min(100%, 20rem)" options='[{"value":"de","label":"Germany","children":[{"value":"de-be","label":"Berlin","children":[{"value":"mitte","label":"Mitte"},{"value":"kreuzberg","label":"Kreuzberg"}]},{"value":"de-by","label":"Bavaria","children":[{"value":"munich","label":"Munich"},{"value":"nuremberg","label":"Nuremberg"}]}]},{"value":"jp","label":"Japan","children":[{"value":"jp-13","label":"Tokyo","children":[{"value":"shibuya","label":"Shibuya"},{"value":"shinjuku","label":"Shinjuku"}]}]},{"value":"is","label":"Iceland","disabled":true}]'></pm-cascader>

Sizes

Set with the size attribute; controls keep touch-sized targets on phones.

size="sm"
size="md"
size="lg"

States

Each state is one attribute.

Disabled
Read-only
Required
Error
With a hint

Overview

Up and Down move within a column, Right opens the next level, Left goes back, Enter chooses. By default only the last level can be chosen; any-level lets a parent be the answer. Form-associated: submits the chosen value.

Attributes

AttributeTypeDefaultDescription
optionsCascaderOption[][]Nested options: { value, label, children? }. Values must be unique across all levels.
valuestring—Value of the chosen option.
namestring—Form field name: the value is submitted under it.
labelstringChooseVisible label (use hide-label to hide it visually).
placeholderstringSelect…Shown while nothing is chosen.
hintstring—Help text under the field.
errorstring—Custom error message. Setting it marks the field invalid.
size'sm' | 'md' | 'lg'—Field size.
requiredbooleanfalseThe form cannot be submitted until a value is chosen.
disabledbooleanfalseNot interactive and not submitted.
any-level
prop: anyLevel
booleanfalseLet options that have children be chosen too (Enter or a second click).
separatorstring / Text between the levels in the field (default " / ").
hide-label
prop: hideLabel
booleanfalseHide the label visually; it stays the accessible name.
readonlybooleanfalseFocusable and submitted, but the user cannot change the value.

Also accepts the contextual attributes tone, surface, radius, density, motion, elevation. They are inherited from ancestors' data-* attributes.

Events

EventReact / Svelte propDescription
pm-changeonPmChangeA value was chosen or cleared.

Methods

clear(), checkValidity(), reportValidity(), validate()