Diwa Design System

Select

Select allows users to choose a single option from a filterable dropdown list. Supports keyboard navigation, validation states, and dense mode (compact) for space-constrained layouts.

diwa-select — Properties

NameTypeDefaultDescription
theme'light' | 'dark''dark'Per-component theme override. Sets data-theme on the host so token overrides cascade into Shadow DOM.
labelstringundefinedVisible label text. Also used as the placeholder when no option is selected.
descriptionstringundefinedOptional hint text rendered between the label and the trigger.
namestring''Field name emitted in the change event detail.
valuestring | undefinedundefinedCurrently selected value. Mutable — updated by user interaction and programmatic assignment.
state'none' | 'error' | 'success''none'Validation state. Controls border colour and message colour.
messagestringundefinedHelper or validation message. Only rendered when state is not "none".
hide-labelbooleanfalseVisually hides the label while keeping it accessible to screen readers.
disabledbooleanfalseDisables the component. Prevents opening and applies reduced opacity.
requiredbooleanfalseMarks the field as required. Adds an asterisk to the label and sets aria-required.
compactbooleanfalseEnables dense mode. Reduces trigger height from 44 px (default touch target) to 32 px.
dropdown-direction'auto' | 'up' | 'down''auto'Controls which direction the dropdown opens. "auto" detects available viewport space.

diwa-select — Events

NameDetail typeBubblesDescription
change{ name: string; value: string }YesEmitted when the user selects an option.
toggle{ open: boolean }NoEmitted when the dropdown opens or closes.
blurvoidNoEmitted when the dropdown closes due to an outside click.

React 19: use lowercase event names as props: onchange, ontoggle, onblur.

diwa-select — Methods

SignatureDescription
open(): Promise<void>Programmatically opens the dropdown.
close(): Promise<void>Programmatically closes the dropdown.

diwa-select-option — Properties

NameTypeDefaultDescription
valuestring | undefinedundefinedThe value emitted when this option is selected. Omit to create a deselect / placeholder option.
disabledbooleanfalseDisables the option — it is shown but cannot be selected.
selectedbooleanfalseWhether the option is currently selected. Managed by the parent diwa-select.
highlightedbooleanfalseWhether the option is keyboard-highlighted. Set exclusively by the parent.
theme'light' | 'dark''dark'Theme — inherited automatically from the parent diwa-select.