Component docs
Loading
"use client";
import { Select } from "@pixxl-tools/components";| Prop | Type | Default | Description |
|---|---|---|---|
options (required) | readonly SelectOption<Value>[] | — | Options to choose from. |
defaultValue | Value | — | Initial value when uncontrolled. |
invalid | boolean | — | Marks the select invalid (aria-invalid); FormField sets it from error. |
onValueChange | ( value: Value, event: ChangeEvent<HTMLSelectElement>, ) => void | — | Called with the new value (only when it changes). |
placeholder | string | — | Muted first option shown until a value is chosen. |
size | ComponentSize | — | Size from the shared scale (xs, sm, md, lg). |
value | Value | — | Current value (controlled); null where it means "nothing selected". |
optionsrequiredreadonly SelectOption<Value>[]
Options to choose from.
defaultValueValue
Initial value when uncontrolled.
invalidboolean
Marks the select invalid (aria-invalid); FormField sets it from error.
onValueChange( value: Value, event: ChangeEvent<HTMLSelectElement>, ) => void
Called with the new value (only when it changes).
placeholderstring
Muted first option shown until a value is chosen.
sizeComponentSize
Size from the shared scale (xs, sm, md, lg).
valueValue
Current value (controlled); null where it means "nothing selected".
Other props are passed to the root element (SelectHTMLAttributes<HTMLSelectElement>), including className, style, id and aria-* attributes.
const options = [
{ label: "candraw", value: "candraw" },
{ label: "cantext", value: "cantext" },
];
<Select options={options} />