Skip to content
THE COMPONENT LIBRARY
Skip to content

Component reference

Select

Single selection with a styled listbox or an explicit native option.

Preview

Live preview

Changes apply to this preview only.

Loading the interactive example?

Width adapts to the available space

More examples

Different configurations and compositions using the real Pimolu API. Each preview runs independently and follows the site appearance.

Sizes

From xs to xxl.

Open preview

Variants

The semantic tone of the field.

Open preview

Appearances

Outline, soft, filled and glass.

Open preview

Usage

Declare literal option and optgroup children so the component can parse the choices. Use onValueChange for the styled path; native onChange belongs to native mode.

Use native when the platform menu is preferable. value/defaultValue are strings, and name enables form submission.

API reference

Generated from the public TypeScript declarations. Native HTML attributes are inherited where the component extends them; this reference includes Pimolu props and selected common native attributes.

PimoluSelectProps

Type source
PimoluSelectProps public API
NameTypeDefaultDescription
size"xs" | "sm" | "md" | "lg" | "xl" | "xxl" | undefined"md"Visual size, not the native HTML size.
variant"primary" | "secondary" | "neutral" | "success" | "warning" | "danger" | undefined"neutral"Semantic color.
appearance"soft" | "outline" | "glass" | "filled" | undefined"outline"Visual appearance.
labelstring | undefined—Visible label.
placeholderstring | undefined—Initial empty option.
helperTextstring | undefined—Supporting text below the field.
errorMessagestring | undefined—Error text, replacing helper text.
invalidboolean | undefinedfalseExplicit invalid state.
fullWidthboolean | undefinedfalseStretch to parent width.
nativeboolean | undefinedfalseRender the native `<select>` instead of the styled listbox. The open menu is then drawn by the platform, which is the right choice on touch devices and in a strongly constrained environment.
valuestring | undefined—Controlled selection.
defaultValuestring | undefined—Initial uncontrolled selection.
onValueChange((value: string) => void) | undefined—Called with the selected value. This is the callback to use: the styled control reports every selection through it, while the native React `onChange` only fires when the platform menu is the one being used (`native`).
containerClassNamestring | undefined—Class applied to the outer container.
onChangeChangeEventHandler<HTMLSelectElement, HTMLSelectElement> | undefined—Standard React/HTML attribute.
classNamestring | undefined—Standard React/HTML attribute.
styleCSSProperties | undefined—Standard React/HTML attribute.
aria-labelstring | undefined—Defines a string value that labels the current element.
childrenReactNode—Standard React/HTML attribute.
onClickMouseEventHandler<HTMLSelectElement> | undefined—Standard React/HTML attribute.
disabledboolean | undefinedfalseStandard React/HTML attribute.
namestring | undefined—Standard React/HTML attribute.
requiredboolean | undefinedfalseStandard React/HTML attribute.
size

"xs" | "sm" | "md" | "lg" | "xl" | "xxl" | undefined

Default: "md"

Visual size, not the native HTML size.

variant

"primary" | "secondary" | "neutral" | "success" | "warning" | "danger" | undefined

Default: "neutral"

Semantic color.

appearance

"soft" | "outline" | "glass" | "filled" | undefined

Default: "outline"

Visual appearance.

label

string | undefined

No default extracted.

Visible label.

placeholder

string | undefined

No default extracted.

Initial empty option.

helperText

string | undefined

No default extracted.

Supporting text below the field.

errorMessage

string | undefined

No default extracted.

Error text, replacing helper text.

invalid

boolean | undefined

Default: false

Explicit invalid state.

fullWidth

boolean | undefined

Default: false

Stretch to parent width.

native

boolean | undefined

Default: false

Render the native `<select>` instead of the styled listbox. The open menu is then drawn by the platform, which is the right choice on touch devices and in a strongly constrained environment.

value

string | undefined

No default extracted.

Controlled selection.

defaultValue

string | undefined

No default extracted.

Initial uncontrolled selection.

onValueChange

((value: string) => void) | undefined

No default extracted.

Called with the selected value. This is the callback to use: the styled control reports every selection through it, while the native React `onChange` only fires when the platform menu is the one being used (`native`).

containerClassName

string | undefined

No default extracted.

Class applied to the outer container.

onChange

ChangeEventHandler<HTMLSelectElement, HTMLSelectElement> | undefined

No default extracted.

Standard React/HTML attribute.

className

string | undefined

No default extracted.

Standard React/HTML attribute.

style

CSSProperties | undefined

No default extracted.

Standard React/HTML attribute.

aria-label

string | undefined

No default extracted.

Defines a string value that labels the current element.

children

ReactNode

No default extracted.

Standard React/HTML attribute.

onClick

MouseEventHandler<HTMLSelectElement> | undefined

No default extracted.

Standard React/HTML attribute.

disabled

boolean | undefined

Default: false

Standard React/HTML attribute.

name

string | undefined

No default extracted.

Standard React/HTML attribute.

required

boolean | undefined

Default: false

Standard React/HTML attribute.

Accessibility

  • Provide label or aria-label and meaningful option labels.
  • Check arrow navigation, Enter and Escape. Disabled options stay visible and cannot be chosen.
Read the accessibility guide →