Skip to content

Native select

Selects one option with the native HTML select element.

native-select-demo.tsx

Installation

The CLI adds the files, packages, theme variables, and Tailwind plugin that this component uses. Before you run it, set up your project.

Groups

native-select-groups-demo.tsx

Disabled

native-select-disabled-demo.tsx

Invalid selection

Set error to show a message below the field. Also install Form.

native-select-invalid-demo.tsx

Sizes

The browser draws the option list, so its size does not change.

native-select-sizes-demo.tsx

API reference

label: stringRequired
Visible label for the select.
size: "xs" | "sm" | "md" | "lg" | "xl" = "lg"
Sets the size of the select box. The HTML size attribute is not available.
description: string
Help text below the select. Linked with aria-describedby.
error: string
Validation text below the select. Linked with aria-describedby. A value also marks the select invalid.
isInvalid: boolean = false
Marks the select invalid. A value for error does the same.
placeholder: string
Adds an empty option.
containerClassName: string
Classes for the outer field layout.