Behive Tech Component Registry

Select

v0.5.0Stable

A bare select control (built on Radix's `Select`) — the Radix trigger button is this component's own root element. It has no built-in label/hint/error; wrap it in `FormField` for that chrome.

pnpm add @behivetech/atoms.select

A bare select control (built on Radix's Select) — the Radix trigger button is this component's own root element. It has no built-in label/hint/error; wrap it in FormField for that chrome.

Usage

Open in new tab

Pass invalid (adds the --invalid modifier and sets aria-invalid) to visually mark the field as invalid (pair with FormField's error prop for the message).

Properties

Select props

PropTypeDefaultDescription
options*SelectOption[]—Options rendered in the dropdown
asChildboolean——
classNamestring—Additional class names to merge with the component root element
defaultValuestring—Initial selected value for uncontrolled usage
invalidbooleanfalseMarks the field as invalid: adds the `--invalid` modifier and sets `aria-invalid="true"`
namestring—Form field name submitted with the value
onValueChange((value: string) => void)—Called with the new value when the selection changes
placeholderstring—Text shown when no value is selected
requiredboolean—Marks the field as required for form validation
valuestring—Controlled selected value

Also accepts the native attributes of its root element (className, aria-*, event handlers, …).