Skip to Content
DocsEnterpriseBlogShowcase

Select (Native)

Used to pick a value from predefined options.

SourceStorybookRecipeSourceStorybookRecipe

Setup

If you don't already have the snippet, run the following command to add the native-select snippet

chakra snippet add native-select

The snippet includes a closed component composition for the NativeSelect component.

Usage

import {
  NativeSelectField,
  NativeSelectRoot,
} from "@/components/ui/native-select"
<NativeSelectRoot>
  <NativeSelectField>
    <option value="1">Option 1</option>
    <option value="2">Option 2</option>
  </NativeSelectField>
</NativeSelectRoot>

Examples

Sizes

Use the size prop to change the size of the select component.

Variants

Use the variant prop to change the appearance of the select component.

Items Prop

Pass the items prop to the NativeSelectField component to render a list of options.

Controlled

Use the value and onChange props to control the select component.

Hook Form

Here is an example of how to use the NativeSelect component with react-hook-form.

Props

Root

PropDefaultType
colorPalette 'gray'
'gray' | 'red' | 'orange' | 'yellow' | 'green' | 'teal' | 'blue' | 'cyan' | 'purple' | 'pink' | 'accent'

The color palette of the component

variant 'outline'
'outline' | 'filled' | 'plain'

The variant of the component

size 'md'
'lg' | 'md' | 'sm' | 'xs'

The size of the component

as
React.ElementType

The underlying element to render.

asChild
boolean

Use the provided child element as the default rendered element, combining their props and behavior.

For more details, read our Composition guide.
unstyled
boolean

Whether to remove the component's style.