Skip to main content

Select

Let people choose one option from a menu with a select control. See default and disabled examples.

Examples

Default

Breakpoints

Mobile

320px

Mobile Lg

480px

Tablet

640px

Desktop

1024px
select-demo.tsx
import { Select } from '@uswds-tailwind/react'
export default function SelectDemo() {
return (
<div className="max-w-sm">
<label htmlFor="select-default" className="block">Dropdown label</label>
<Select.Root>
<Select.Field id="select-default" defaultValue="">
<option value="" disabled>- Select -</option>
<option value="value1">Option A</option>
<option value="value2">Option B</option>
<option value="value3">Option C</option>
</Select.Field>
<Select.Icon />
</Select.Root>
</div>
)
}

Disabled

Breakpoints

Mobile

320px

Mobile Lg

480px

Tablet

640px

Desktop

1024px
select-disabled-demo.tsx
import { Select } from '@uswds-tailwind/react'
export default function SelectDisabledDemo() {
return (
<div className="max-w-sm">
<label htmlFor="select-disabled" className="block">Dropdown label</label>
<Select.Root disabled>
<Select.Field id="select-disabled" defaultValue="">
<option value="" disabled>- Select -</option>
<option value="value1">Option A</option>
<option value="value2">Option B</option>
<option value="value3">Option C</option>
</Select.Field>
<Select.Icon />
</Select.Root>
</div>
)
}

Component API

Put Field and optional Icon inside Root. Field is the native select control.

Root<div>

Owns value and validation state.

PropTypeDescription
defaultValuestringInitial uncontrolled selection.
valuestringControlled selection.
onValueChange(value: string) => voidReceives selection changes.
namestringForm field name.
requiredbooleanRequires a selection.
disabledbooleanDisables the select.
invalidbooleanMarks the selection invalid.
readOnlybooleanPasses readOnly to the select. Native select elements do not enforce read-only behavior; use disabled to prevent interaction.
AttributeValuePurpose
data-disabledPresent when disabledStyle the disabled state.
data-invalidPresent when invalidStyle the error state.

Field<select>

Native select control containing option elements.

AttributeValuePurpose
data-disabledPresent when disabledStyle the disabled state.
data-invalidPresent when invalidStyle the error state.

Icon<div>

Displays the dropdown indicator.

AttributeValuePurpose
data-disabledPresent when disabledStyle the disabled state.
data-invalidPresent when invalidStyle the error state.