FORMS / COMPONENT 25

Select

React component

Choose an option from a rounded, optionally grouped list.

Try it out

Use the live controls or open the Code tab to view and copy the example.

API reference

Generated from the package’s TypeScript exports. Standard React event and ARIA attributes are also accepted where the component wraps a native element.

PropTypeDescription
optionsRequiredSelectOption[]Selectable values with stable unique identifiers.
placeholderstring | undefinedStandard React / HTML attribute passed to the underlying element.
onValueChange((value: string) => void) | undefinedCalled with the next value. Update controlled state here.
autoCompletestring | undefinedStandard React / HTML attribute passed to the underlying element.
disabledboolean | undefinedDisables interaction (or date matchers for DatePicker).
namestring | undefinedField name used in form submission.
requiredboolean | undefinedParticipates in native form validation.
valuestring | number | readonly string[] | undefinedControlled value. Pair with its change callback.
onChangeChangeEventHandler<HTMLSelectElement, HTMLSelectElement> | undefinedStandard React / HTML attribute passed to the underlying element.
defaultCheckedboolean | undefinedStandard React / HTML attribute passed to the underlying element.
defaultValuestring | number | readonly string[] | undefinedInitial value for uncontrolled usage.
classNamestring | undefinedAdditional CSS class names.
idstring | undefinedStandard React / HTML attribute passed to the underlying element.
styleCSSProperties | undefinedInline styles, including CSS custom property overrides.
relstring | undefinedStandard React / HTML attribute passed to the underlying element.
childrenReactNodeContent rendered inside the component.
onFocusFocusEventHandler<HTMLSelectElement> | undefinedStandard React / HTML attribute passed to the underlying element.
onBlurFocusEventHandler<HTMLSelectElement> | undefinedStandard React / HTML attribute passed to the underlying element.
onErrorReactEventHandler<HTMLSelectElement> | undefinedStandard React / HTML attribute passed to the underlying element.
onClickMouseEventHandler<HTMLSelectElement> | undefinedStandard React / HTML attribute passed to the underlying element.
labelRequiredstringA meaningful visible or accessible label.
descriptionstring | undefinedSupporting instructions associated with the control.
errorstring | undefinedValidation message; also sets aria-invalid.
hideLabelboolean | undefinedSee the typed definition and working example for this option.

Accessibility & interaction

Use a persistent visible label and provide textual errors; native controls support keyboard input and browser form constraints.

Visible focus, reduced motion, and both color themes are shared across staqui. Choose labels and document structure that make sense in your application; automated checks do not replace assistive-technology testing.

Variants & implementation notes

Single-select options can include descriptions. The selected option shows a checkmark. Multiple selection and listbox sizing use the native control.

Use the typed API above for the supported variants. The example demonstrates the primary composition; shared controls inherit hover, focus, active and disabled treatment where applicable.

Compose with