Behive Tech Registry

Select

v0.4.0

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

Pass aria-invalid="true" to visually mark the field as invalid (pair with FormField's error prop for the message).

Props

PropTypeDefaultDescription
optionsSelectOption[]—Array of { label, value, disabled? } (required)
valuestring—Controlled selected value
defaultValuestring—Uncontrolled initial value
onValueChange(value: string) => void—Called when the selection changes
placeholderstring—Placeholder shown when nothing is selected
disabledbooleanfalseDisables the field
requiredbooleanfalseMarks field as required
classNamestring—Additional class names

Compositions

Open all 4 →

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
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, …).