Selection and input · Material 3: Menus (exposed dropdown)
Select
Pick one option from a list. The list grows from the trigger, the highlight slides, and the value rolls into place.
Examples and variants
Select
Custom list with the sliding highlight.
function SelectBasic() {
return (
<Select defaultValue="calm">
<SelectTrigger aria-label="Motion">
<SelectValue />
</SelectTrigger>
<SelectContent>
<SelectItem value="still">Still</SelectItem>
<SelectItem value="calm">Calm</SelectItem>
<SelectItem value="liquid">Liquid</SelectItem>
</SelectContent>
</Select>
)
}Native
The platform picker, styled. Best on phones and in long forms.
function SelectNative() {
return (
<NativeSelect defaultValue="calm" aria-label="Motion">
<NativeSelectOption value="still">Still</NativeSelectOption>
<NativeSelectOption value="calm">Calm</NativeSelectOption>
<NativeSelectOption value="liquid">Liquid</NativeSelectOption>
</NativeSelect>
)
}Spec drawing
Measured from the live component at default density. Each code maps to the token that sets it; change the token and the drawing follows.
Install
With the CLI
The shadcn CLI only delivers files: it copies our code from the Isotopi registry into your project and installs the packages it uses. Add the foundation once, then the component.
npx shadcn@latest add https://isotopi.com/r/minimal.json
npx shadcn@latest add https://isotopi.com/r/select.json
npx shadcn@latest add https://isotopi.com/r/native-select.jsonBy hand
No CLI needed. Add the foundation once (see Getting started), then follow these steps. They include every component this one builds on.
Install the packages it uses.
Terminalnpm install @base-ui/react cn lucide-reactCopy these 2 files to the same paths in your project. Imports use the
@/alias for your project root.components/ui/select.tsxselect
components/ui/select.tsx"use client" import * as React from "react" import { Select as SelectPrimitive } from "@base-ui/react/select" import { cn } from "cn" import { ChevronDownIcon, CheckIcon } from "lucide-react" import { layoutTop } from "@/lib/motion/layout-offset" const Select = SelectPrimitive.Root function SelectGroup({ className, ...props }: SelectPrimitive.Group.Props) { return ( <SelectPrimitive.Group data-slot="select-group" className={cn("scroll-my-1 p-1", className)} {...props} /> ) } function SelectValue({ className, ...props }: SelectPrimitive.Value.Props) { const holder = React.useRef<HTMLSpanElement>(null) const previous = React.useRef("") const [roll, setRoll] = React.useState<{ from: string; to: string; id: number } | null>(null) React.useEffect(() => { const node = holder.current if (!node) return const read = () => { const text = node.querySelector("[data-slot=select-value]")?.textContent?.trim() ?? "" if (!text || text === previous.current) return const motion = node.closest<HTMLElement>("[data-motion]")?.dataset.motion const reduced = window.matchMedia("(prefers-reduced-motion: reduce)").matches if (previous.current && motion !== "calm" && motion !== "still" && !reduced) { setRoll({ from: previous.current, to: text, id: Date.now() }) } previous.current = text } read() const observer = new MutationObserver(read) observer.observe(node, { subtree: true, childList: true, characterData: true }) return () => observer.disconnect() }, []) return ( <span ref={holder} className="relative inline-grid overflow-hidden"> <SelectPrimitive.Value data-slot="select-value" className={cn("col-start-1 row-start-1 flex flex-1 text-left", roll && "invisible", className)} {...props} /> {roll ? ( <span key={roll.id} aria-hidden className="select-roll col-start-1 row-start-1" onAnimationEnd={() => setRoll(null)}> <span className="select-roll-out">{roll.from}</span> <span className="select-roll-in">{roll.to}</span> </span> ) : null} </span> ) } function SelectTrigger({ className, size = "default", children, ...props }: SelectPrimitive.Trigger.Props & { size?: "sm" | "default" }) { return ( <SelectPrimitive.Trigger data-slot="select-trigger" data-size={size} className={cn( "flex w-fit items-center justify-between gap-inline-sm rounded-(--field-corner) border-solid border-(length:--field-stroke-width) border-(--field-stroke-color) bg-(--field-container) hover:bg-(--field-container-hover) py-(--field-padding-y) pe-(--field-padding-x) ps-(--field-padding-x) text-sm whitespace-nowrap shadow-(--field-elevation) outline-none transition-[background-color,box-shadow] duration-(--duration-fast) ease-(--ease-out) select-none focus-visible:bg-(--field-container-focus) focus-visible:shadow-(--field-focus-shadow) disabled:cursor-not-allowed disabled:bg-(--field-container-disabled) disabled:text-(--field-label-disabled) disabled:shadow-none data-placeholder:text-(--field-placeholder) data-[size=default]:h-(--field-height-md) data-[size=sm]:h-control-sm [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-icon-sm", className )} {...props} > {children} <SelectPrimitive.Icon render={ <ChevronDownIcon className="pointer-events-none size-4 text-muted-foreground" /> } /> </SelectPrimitive.Trigger> ) } function SelectContent({ className, children, side = "bottom", sideOffset = 4, align = "center", alignOffset = 0, alignItemWithTrigger = false, ...props }: SelectPrimitive.Popup.Props & Pick< SelectPrimitive.Positioner.Props, "align" | "alignOffset" | "side" | "sideOffset" | "alignItemWithTrigger" >) { return ( <SelectPrimitive.Portal> <SelectPrimitive.Positioner side={side} sideOffset={sideOffset} align={align} alignOffset={alignOffset} alignItemWithTrigger={alignItemWithTrigger} className="isolate z-(--z-dropdown)" > <SelectPrimitive.Popup data-slot="select-content" data-align-trigger={alignItemWithTrigger} className={cn( "menu-scroll grow-from-origin relative isolate z-(--z-dropdown) h-auto max-h-(--available-height) w-(--anchor-width) min-w-36 overflow-x-hidden overflow-y-auto rounded-(--menu-corner) bg-(--menu-container) p-(--space-2) text-foreground shadow-(--menu-elevation) outline-none", className )} {...props} > <SelectHighlight>{children}</SelectHighlight> </SelectPrimitive.Popup> </SelectPrimitive.Positioner> </SelectPrimitive.Portal> ) } function SelectHighlight({ children }: { children: React.ReactNode }) { const ref = React.useRef<HTMLDivElement>(null) const [box, setBox] = React.useState({ top: 0, height: 0 }) const [ready, setReady] = React.useState(false) React.useLayoutEffect(() => { const root = ref.current if (!root) return const read = () => { const items = [...root.querySelectorAll<HTMLElement>("[data-slot=select-item]")] const item = items.find((entry) => entry.hasAttribute("data-highlighted")) if (!item) return setBox({ top: layoutTop(item, root), height: item.offsetHeight }) setReady(true) } read() const observer = new MutationObserver(read) observer.observe(root, { subtree: true, attributes: true, attributeFilter: ["data-highlighted"] }) const resize = new ResizeObserver(read) resize.observe(root) return () => { observer.disconnect() resize.disconnect() } }, []) return ( <div ref={ref} className="relative"> {ready ? ( <span aria-hidden className="select-pill pointer-events-none absolute right-0 left-0 rounded-(--menu-item-corner) bg-(--menu-item-highlight)" style={{ top: box.top, height: box.height }} /> ) : null} <SelectPrimitive.List>{children}</SelectPrimitive.List> </div> ) } function SelectLabel({ className, ...props }: SelectPrimitive.GroupLabel.Props) { return ( <SelectPrimitive.GroupLabel data-slot="select-label" className={cn("px-1.5 py-1 text-xs text-muted-foreground", className)} {...props} /> ) } function SelectItem({ className, children, ...props }: SelectPrimitive.Item.Props) { return ( <SelectPrimitive.Item data-slot="select-item" className={cn( "select-item relative z-[1] flex w-full cursor-default items-center gap-inline-sm rounded-(--menu-item-corner) py-(--space-inset-control-y) pr-8 pl-(--menu-item-padding-x) text-sm outline-hidden select-none data-disabled:pointer-events-none data-disabled:text-(--menu-item-label-disabled)", className )} {...props} > <SelectPrimitive.ItemText className="flex flex-1 shrink-0 gap-2 whitespace-nowrap"> {children} </SelectPrimitive.ItemText> <SelectPrimitive.ItemIndicator render={ <span className="pointer-events-none absolute right-2 flex size-4 items-center justify-center" /> } > <CheckIcon className="pointer-events-none" /> </SelectPrimitive.ItemIndicator> </SelectPrimitive.Item> ) } function SelectSeparator({ className, ...props }: SelectPrimitive.Separator.Props) { return ( <SelectPrimitive.Separator data-slot="select-separator" className={cn("pointer-events-none my-1 h-stack-sm", className)} {...props} /> ) } export { Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectSeparator, SelectTrigger, SelectValue, }components/ui/native-select.tsxnative-select
components/ui/native-select.tsximport * as React from "react" import { cn } from "cn" import { ChevronDownIcon } from "lucide-react" type NativeSelectProps = Omit<React.ComponentProps<"select">, "size"> & { size?: "sm" | "default" } function NativeSelect({ className, size = "default", ...props }: NativeSelectProps) { return ( <div className={cn("relative w-fit", className)} data-slot="native-select-wrapper" data-size={size} > <select data-slot="native-select" data-size={size} className="h-(--field-height-md) w-full min-w-40 appearance-none rounded-(--field-corner) border-solid border-(length:--field-stroke-width) border-(--field-stroke-color) bg-(--field-container) hover:bg-(--field-container-hover) pr-8 ps-(--field-padding-x) text-sm text-(--field-label) shadow-(--field-elevation) outline-none transition-[background-color,box-shadow] duration-(--duration-fast) ease-(--ease-out) focus-visible:bg-(--field-container-focus) focus-visible:shadow-(--field-focus-shadow) disabled:cursor-not-allowed disabled:bg-(--field-container-disabled) disabled:text-(--field-label-disabled) disabled:shadow-none data-[size=sm]:h-control-sm" {...props} /> <ChevronDownIcon className="pointer-events-none absolute top-1/2 right-3 size-icon-sm -translate-y-1/2 text-muted-foreground" aria-hidden data-slot="native-select-icon" /> </div> ) } function NativeSelectOption({ className, ...props }: React.ComponentProps<"option">) { return <option data-slot="native-select-option" className={className} {...props} /> } function NativeSelectOptGroup({ className, ...props }: React.ComponentProps<"optgroup">) { return <optgroup data-slot="native-select-optgroup" className={className} {...props} /> } export { NativeSelect, NativeSelectOptGroup, NativeSelectOption }
Imports
What the examples on this page import:
import { NativeSelect, NativeSelectOption } from "@/components/ui/native-select"
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select"Anatomy
- 1Trigger · Same tokens as the text field (--field-*).
- 2List · --menu-container, --menu-corner, --menu-elevation.
- 3Highlight · --menu-item-highlight, slides between items.
- 4Check · Marks the selected item.
Props
| Prop | Type | Default | Description |
|---|---|---|---|
value / defaultValue | string | — | Selected value. |
onValueChange | (value: string) => void | — | Called on change. |
SelectTrigger size | "sm" | "default" | "default" | Trigger height. |
Tokens
Every visual spec is a component token in styles/tokens/components.css, pointing at a semantic token. Change a token to restyle the component; themes change the semantic layer.
| Token | Points to | Light | Dark |
|---|---|---|---|
--field-height-sm | var(--size-control-sm) | 32px | same |
--field-height-md | var(--size-control-md) | 40px | same |
--field-height-lg | var(--size-control-lg) | 48px | same |
--field-padding-x | var(--space-inset-control-x) | 12px | same |
--field-padding-x-text | var(--space-inset-control-x-lg) | 16px | same |
--field-padding-y | var(--space-inset-control-y) | 8px | same |
--field-corner | var(--shape-full) | 999px | same |
--field-corner-multiline | var(--shape-md) | 14px | same |
--field-container | var(--surface-container) | oklch(0.965 0.005 95) | oklch(0.12 0 0) |
--field-container-focus | var(--surface-container-lowest) | oklch(1 0 0) | oklch(0.14 0 0) |
--field-label | var(--on-surface) | oklch(0.22 0.01 260) | oklch(1 0 0) |
--field-container-hover | color-mix(in oklch, var(--field-container), var(--field-label) var(--state-hover-mix)) | color-mix(in oklch, var(--field-container), var(--field-label) var(--state-hover-mix)) | same |
--field-container-disabled | var(--color-bg-disabled) | color-mix(in oklch, var(--color-fg-default) var(--state-disabled-container-mix), transparent) | same |
--field-label-disabled | var(--color-fg-disabled) | oklch(0.62 0.01 95) | oklch(0.53 0 0) |
--field-placeholder | var(--on-surface-variant) | oklch(0.45 0.01 95) | oklch(0.68 0 0) |
--field-stroke-width | var(--stroke-width-control) | 0px | same |
--field-stroke-color | var(--stroke-color-default) | oklch(0.22 0.01 260 / 18%) | oklch(1 0 0 / 12%) |
--field-elevation | var(--elevation-1) | 0 1px 1px -0.5px oklch(0.22 0.01 260 / 7%), 0 2px 3px -1px oklch(0.22 0.01 260 / 10%), 0 4px 8px -4px oklch(0.22 0.01 260 / 6%) | 0 1px 2px oklch(0 0 0 / 35%), 0 2px 10px oklch(0 0 0 / 25%) |
--field-focus-halo-width | var(--state-field-stroke) | 3px | same |
--field-focus-shadow | var(--focus-field) | 0 0 0 var(--state-field-stroke) color-mix(in oklch, var(--color-fg-default) var(--state-field-stroke-mix), transparent), var(--elevation-3) | same |
--field-error-shadow | var(--focus-ring-invalid) | 0 0 0 var(--state-focus-ring-offset) var(--focus-ring-gap, var(--color-bg-canvas)), 0 0 0 calc(var(--state-focus-ring-offset) + var(--state-focus-ring-width)) var(--color-danger) | same |
--field-label-gap | var(--space-1) | 4px | same |
--field-action-label | var(--field-placeholder) | oklch(0.45 0.01 95) | oklch(0.68 0 0) |
--field-action-label-hover | var(--field-label) | oklch(0.22 0.01 260) | oklch(1 0 0) |
--field-action-container-hover | var(--color-bg-hover) | oklch(0.965 0.005 95) | oklch(0.22 0 0) |
--field-action-container-pressed | var(--color-bg-pressed) | oklch(0.94 0.007 95) | oklch(0.27 0 0) |
--field-choice-container-hover | color-mix(in oklch, var(--field-container), var(--field-label) var(--state-hover-mix)) | color-mix(in oklch, var(--field-container), var(--field-label) var(--state-hover-mix)) | same |
--menu-container | var(--surface-container-raised) | oklch(1 0 0) | oklch(0.22 0 0) |
--menu-corner | var(--shape-md) | 14px | same |
--menu-padding | var(--space-inset-overlay) | 8px | same |
--menu-elevation | var(--elevation-2) | 0 1px 1px -0.5px oklch(0.22 0.01 260 / 6%), 0 3px 3px -1.5px oklch(0.22 0.01 260 / 6%), 0 6px 6px -3px oklch(0.22 0.01 260 / 6%), 0 12px 12px -6px oklch(0.22 0.01 260 / 6%), 0 24px 24px -12px oklch(0.22 0.01 260 / 6%) | 0 4px 12px oklch(0 0 0 / 40%), 0 12px 28px oklch(0 0 0 / 35%) |
--menu-item-height | var(--size-row-sm) | 32px | same |
--menu-item-padding-x | var(--space-inset-control-x-sm) | 8px | same |
--menu-item-corner | var(--shape-sm) | 8px | same |
--menu-item-highlight | var(--color-bg-hover) | oklch(0.965 0.005 95) | oklch(0.22 0 0) |
--menu-item-label-disabled | var(--color-fg-disabled) | oklch(0.62 0.01 95) | oklch(0.53 0 0) |
--menu-item-danger | var(--color-danger-fg) | oklch(0.48 0.18 25) | oklch(0.78 0.14 22) |
--menu-min-width | var(--layout-menu-min) | 180px | same |
Motion
| Trigger | What happens | Tokens |
|---|---|---|
| Open | The list grows from the trigger; items rise in with a stagger. | --duration-fast, --duration-stagger |
| Highlight | The pill slides between items. | --duration-fast |
| Pick | The value rolls into the trigger. | --duration-fast |
Calm keeps the motion without overshoot. Still (and reduced motion) keeps a designed frame with no movement.
Accessibility
- Arrow keys move; typing jumps to an option; Enter selects; Escape closes.
- Label the trigger.
Usage
Do
- Use for 5+ options.
Don’t
- Don't use for 2 or 3 options (use Radio group or Segmented control).
Code
"use client"
import * as React from "react"
import { Select as SelectPrimitive } from "@base-ui/react/select"
import { cn } from "cn"
import { ChevronDownIcon, CheckIcon } from "lucide-react"
import { layoutTop } from "@/lib/motion/layout-offset"
const Select = SelectPrimitive.Root
function SelectGroup({ className, ...props }: SelectPrimitive.Group.Props) {
return (
<SelectPrimitive.Group
data-slot="select-group"
className={cn("scroll-my-1 p-1", className)}
{...props}
/>
)
}
function SelectValue({ className, ...props }: SelectPrimitive.Value.Props) {
const holder = React.useRef<HTMLSpanElement>(null)
const previous = React.useRef("")
const [roll, setRoll] = React.useState<{ from: string; to: string; id: number } | null>(null)
React.useEffect(() => {
const node = holder.current
if (!node) return
const read = () => {
const text = node.querySelector("[data-slot=select-value]")?.textContent?.trim() ?? ""
if (!text || text === previous.current) return
const motion = node.closest<HTMLElement>("[data-motion]")?.dataset.motion
const reduced = window.matchMedia("(prefers-reduced-motion: reduce)").matches
if (previous.current && motion !== "calm" && motion !== "still" && !reduced) {
setRoll({ from: previous.current, to: text, id: Date.now() })
}
previous.current = text
}
read()
const observer = new MutationObserver(read)
observer.observe(node, { subtree: true, childList: true, characterData: true })
return () => observer.disconnect()
}, [])
return (
<span ref={holder} className="relative inline-grid overflow-hidden">
<SelectPrimitive.Value
data-slot="select-value"
className={cn("col-start-1 row-start-1 flex flex-1 text-left", roll && "invisible", className)}
{...props}
/>
{roll ? (
<span key={roll.id} aria-hidden className="select-roll col-start-1 row-start-1" onAnimationEnd={() => setRoll(null)}>
<span className="select-roll-out">{roll.from}</span>
<span className="select-roll-in">{roll.to}</span>
</span>
) : null}
</span>
)
}
function SelectTrigger({
className,
size = "default",
children,
...props
}: SelectPrimitive.Trigger.Props & {
size?: "sm" | "default"
}) {
return (
<SelectPrimitive.Trigger
data-slot="select-trigger"
data-size={size}
className={cn(
"flex w-fit items-center justify-between gap-inline-sm rounded-(--field-corner) border-solid border-(length:--field-stroke-width) border-(--field-stroke-color) bg-(--field-container) hover:bg-(--field-container-hover) py-(--field-padding-y) pe-(--field-padding-x) ps-(--field-padding-x) text-sm whitespace-nowrap shadow-(--field-elevation) outline-none transition-[background-color,box-shadow] duration-(--duration-fast) ease-(--ease-out) select-none focus-visible:bg-(--field-container-focus) focus-visible:shadow-(--field-focus-shadow) disabled:cursor-not-allowed disabled:bg-(--field-container-disabled) disabled:text-(--field-label-disabled) disabled:shadow-none data-placeholder:text-(--field-placeholder) data-[size=default]:h-(--field-height-md) data-[size=sm]:h-control-sm [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-icon-sm",
className
)}
{...props}
>
{children}
<SelectPrimitive.Icon
render={
<ChevronDownIcon className="pointer-events-none size-4 text-muted-foreground" />
}
/>
</SelectPrimitive.Trigger>
)
}
function SelectContent({
className,
children,
side = "bottom",
sideOffset = 4,
align = "center",
alignOffset = 0,
alignItemWithTrigger = false,
...props
}: SelectPrimitive.Popup.Props &
Pick<
SelectPrimitive.Positioner.Props,
"align" | "alignOffset" | "side" | "sideOffset" | "alignItemWithTrigger"
>) {
return (
<SelectPrimitive.Portal>
<SelectPrimitive.Positioner
side={side}
sideOffset={sideOffset}
align={align}
alignOffset={alignOffset}
alignItemWithTrigger={alignItemWithTrigger}
className="isolate z-(--z-dropdown)"
>
<SelectPrimitive.Popup
data-slot="select-content"
data-align-trigger={alignItemWithTrigger}
className={cn(
"menu-scroll grow-from-origin relative isolate z-(--z-dropdown) h-auto max-h-(--available-height) w-(--anchor-width) min-w-36 overflow-x-hidden overflow-y-auto rounded-(--menu-corner) bg-(--menu-container) p-(--space-2) text-foreground shadow-(--menu-elevation) outline-none",
className
)}
{...props}
>
<SelectHighlight>{children}</SelectHighlight>
</SelectPrimitive.Popup>
</SelectPrimitive.Positioner>
</SelectPrimitive.Portal>
)
}
function SelectHighlight({ children }: { children: React.ReactNode }) {
const ref = React.useRef<HTMLDivElement>(null)
const [box, setBox] = React.useState({ top: 0, height: 0 })
const [ready, setReady] = React.useState(false)
React.useLayoutEffect(() => {
const root = ref.current
if (!root) return
const read = () => {
const items = [...root.querySelectorAll<HTMLElement>("[data-slot=select-item]")]
const item = items.find((entry) => entry.hasAttribute("data-highlighted"))
if (!item) return
setBox({ top: layoutTop(item, root), height: item.offsetHeight })
setReady(true)
}
read()
const observer = new MutationObserver(read)
observer.observe(root, { subtree: true, attributes: true, attributeFilter: ["data-highlighted"] })
const resize = new ResizeObserver(read)
resize.observe(root)
return () => {
observer.disconnect()
resize.disconnect()
}
}, [])
return (
<div ref={ref} className="relative">
{ready ? (
<span
aria-hidden
className="select-pill pointer-events-none absolute right-0 left-0 rounded-(--menu-item-corner) bg-(--menu-item-highlight)"
style={{ top: box.top, height: box.height }}
/>
) : null}
<SelectPrimitive.List>{children}</SelectPrimitive.List>
</div>
)
}
function SelectLabel({
className,
...props
}: SelectPrimitive.GroupLabel.Props) {
return (
<SelectPrimitive.GroupLabel
data-slot="select-label"
className={cn("px-1.5 py-1 text-xs text-muted-foreground", className)}
{...props}
/>
)
}
function SelectItem({
className,
children,
...props
}: SelectPrimitive.Item.Props) {
return (
<SelectPrimitive.Item
data-slot="select-item"
className={cn(
"select-item relative z-[1] flex w-full cursor-default items-center gap-inline-sm rounded-(--menu-item-corner) py-(--space-inset-control-y) pr-8 pl-(--menu-item-padding-x) text-sm outline-hidden select-none data-disabled:pointer-events-none data-disabled:text-(--menu-item-label-disabled)",
className
)}
{...props}
>
<SelectPrimitive.ItemText className="flex flex-1 shrink-0 gap-2 whitespace-nowrap">
{children}
</SelectPrimitive.ItemText>
<SelectPrimitive.ItemIndicator
render={
<span className="pointer-events-none absolute right-2 flex size-4 items-center justify-center" />
}
>
<CheckIcon className="pointer-events-none" />
</SelectPrimitive.ItemIndicator>
</SelectPrimitive.Item>
)
}
function SelectSeparator({
className,
...props
}: SelectPrimitive.Separator.Props) {
return (
<SelectPrimitive.Separator
data-slot="select-separator"
className={cn("pointer-events-none my-1 h-stack-sm", className)}
{...props}
/>
)
}
export {
Select,
SelectContent,
SelectGroup,
SelectItem,
SelectLabel,
SelectSeparator,
SelectTrigger,
SelectValue,
}
import * as React from "react"
import { cn } from "cn"
import { ChevronDownIcon } from "lucide-react"
type NativeSelectProps = Omit<React.ComponentProps<"select">, "size"> & {
size?: "sm" | "default"
}
function NativeSelect({ className, size = "default", ...props }: NativeSelectProps) {
return (
<div
className={cn("relative w-fit", className)}
data-slot="native-select-wrapper"
data-size={size}
>
<select
data-slot="native-select"
data-size={size}
className="h-(--field-height-md) w-full min-w-40 appearance-none rounded-(--field-corner) border-solid border-(length:--field-stroke-width) border-(--field-stroke-color) bg-(--field-container) hover:bg-(--field-container-hover) pr-8 ps-(--field-padding-x) text-sm text-(--field-label) shadow-(--field-elevation) outline-none transition-[background-color,box-shadow] duration-(--duration-fast) ease-(--ease-out) focus-visible:bg-(--field-container-focus) focus-visible:shadow-(--field-focus-shadow) disabled:cursor-not-allowed disabled:bg-(--field-container-disabled) disabled:text-(--field-label-disabled) disabled:shadow-none data-[size=sm]:h-control-sm"
{...props}
/>
<ChevronDownIcon
className="pointer-events-none absolute top-1/2 right-3 size-icon-sm -translate-y-1/2 text-muted-foreground"
aria-hidden
data-slot="native-select-icon"
/>
</div>
)
}
function NativeSelectOption({ className, ...props }: React.ComponentProps<"option">) {
return <option data-slot="native-select-option" className={className} {...props} />
}
function NativeSelectOptGroup({ className, ...props }: React.ComponentProps<"optgroup">) {
return <optgroup data-slot="native-select-optgroup" className={className} {...props} />
}
export { NativeSelect, NativeSelectOptGroup, NativeSelectOption }