Select
Pick from lists. Custom styling. Simplify complex choices.
Installation
Copy and paste the following code into your project.
1'use client';23import { cva, type VariantProps } from 'class-variance-authority';4import { motion, useReducedMotion } from 'motion/react';5import * as React from 'react';6import { cn } from '../lib/cn';7import { useTypeahead } from '../lib/collection';8import { FloatingPortal, useFloating } from '../lib/floating';9import { floatingOrigin, springs, still } from '../lib/motion';10import { useLayer } from '../lib/overlay';11import { useControllableState } from '../lib/use-controllable-state';1213type IconProps = React.SVGProps<SVGSVGElement> & {14 size?: number | string;15};1617function CheckIcon({ size = 24, strokeWidth = 1.5, ...props }: IconProps) {18 return (19 <svg20 xmlns="http://www.w3.org/2000/svg"21 width={size}22 height={size}23 viewBox="0 0 24 24"24 fill="none"25 stroke="currentColor"26 strokeWidth={strokeWidth}27 strokeLinecap="round"28 strokeLinejoin="round"29 aria-hidden="true"30 {...props}31 >32 <path d="m4 12.5 5 5L20 6.5" />33 </svg>34 );35}3637function ChevronDownIcon({ size = 24, strokeWidth = 1.5, ...props }: IconProps) {38 return (39 <svg40 xmlns="http://www.w3.org/2000/svg"41 width={size}42 height={size}43 viewBox="0 0 24 24"44 fill="none"45 stroke="currentColor"46 strokeWidth={strokeWidth}47 strokeLinecap="round"48 strokeLinejoin="round"49 aria-hidden="true"50 {...props}51 >52 <path d="m6 9 6 6 6-6" />53 </svg>54 );55}5657interface SelectContextValue {58 value: string;59 selectValue: (value: string) => void;60 isOpen: boolean;61 openMenu: () => void;62 closeMenu: (options?: { restoreFocus?: boolean }) => void;63 toggleMenu: () => void;64 disabled: boolean;65 labels: ReadonlyMap<string, string>;66 registerItem: (value: string, label: string) => () => void;67 triggerRef: React.RefObject<HTMLButtonElement | null>;68 listRef: React.RefObject<HTMLDivElement | null>;69 triggerId: string;70 contentId: string;71 layer: ReturnType<typeof useLayer>;72}7374interface SelectGroupContextValue {75 labelId: string;76 registerLabel: () => () => void;77}7879interface SelectProps {80 children: React.ReactNode;81 value?: string;82 defaultValue?: string;83 onValueChange?: (value: string) => void;84 open?: boolean;85 defaultOpen?: boolean;86 onOpenChange?: (open: boolean) => void;87 disabled?: boolean;88 name?: string;89 required?: boolean;90 className?: string;91}9293interface SelectTriggerProps94 extends95 Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, 'children'>,96 VariantProps<typeof selectTriggerVariants> {97 placeholder?: string;98 children?: React.ReactNode;99}100101interface SelectContentProps {102 children: React.ReactNode;103 className?: string;104 sideOffset?: number;105}106107interface SelectItemProps {108 value: string;109 children: React.ReactNode;110 textValue?: string;111 disabled?: boolean;112 className?: string;113}114115interface SelectGroupProps {116 children: React.ReactNode;117 className?: string;118}119120interface SelectLabelProps {121 children: React.ReactNode;122 className?: string;123}124125interface SelectSeparatorProps {126 className?: string;127}128129const selectTriggerVariants = cva(130 [131 'bg-secondary text-foreground flex w-full items-center justify-between gap-2 rounded-md text-start transition-[color,box-shadow] outline-none',132 'hover:bg-muted',133 'focus-visible:ring-ring focus-visible:ring-2',134 'aria-invalid:ring-2 aria-invalid:ring-destructive',135 'disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-40',136 'data-[placeholder=true]:text-muted-foreground',137 ],138 {139 variants: {140 size: {141 sm: 'h-8 px-2.5 text-xs',142 default: 'h-9 px-3 text-sm',143 lg: 'h-10 px-4 text-base',144 },145 },146 defaultVariants: {147 size: 'default',148 },149 },150);151152const ICON_VARIANTS = {153 open: { rotate: 180 },154 closed: { rotate: 0 },155} as const;156157const ICON_TRANSITION = springs.snappy;158const ICON_STYLE = { willChange: 'transform' } as const;159const CONTENT_STYLE = { willChange: 'opacity, transform' } as const;160161const CONTENT_OPEN = {162 opacity: 1,163 scale: 1,164 y: 0,165 visibility: 'visible' as const,166 transition: { ...springs.smooth, opacity: { duration: 0.15 } },167};168169const CONTENT_CLOSED = {170 bottom: {171 opacity: 0,172 scale: 0.97,173 y: -4,174 transition: { duration: 0.15 },175 transitionEnd: { visibility: 'hidden' as const },176 },177 top: {178 opacity: 0,179 scale: 0.97,180 y: 4,181 transition: { duration: 0.15 },182 transitionEnd: { visibility: 'hidden' as const },183 },184} as const;185186const SelectContext = React.createContext<SelectContextValue | null>(null);187188const SelectGroupContext = React.createContext<SelectGroupContextValue | null>(null);189190const useSelectContext = (): SelectContextValue => {191 const context = React.use(SelectContext);192 if (!context) throw new Error('Select components must be used within Select');193 return context;194};195196const noop = () => undefined;197198function useClickOutside(199 ref: React.RefObject<HTMLElement | null>,200 triggerRef: React.RefObject<HTMLElement | null>,201 handler: () => void,202 enabled: boolean,203 isInsideUpperLayer: (target: EventTarget | null) => boolean,204) {205 React.useEffect(() => {206 if (!enabled) return;207 const handlePointerDownOutside = (event: PointerEvent) => {208 if (209 ref.current?.contains(event.target as Node) ||210 triggerRef.current?.contains(event.target as Node) ||211 isInsideUpperLayer(event.target)212 ) {213 return;214 }215 handler();216 };217 document.addEventListener('pointerdown', handlePointerDownOutside);218 return () => document.removeEventListener('pointerdown', handlePointerDownOutside);219 }, [ref, triggerRef, handler, enabled, isInsideUpperLayer]);220}221222function getOptions(container: HTMLElement | null): HTMLElement[] {223 if (!container) return [];224 return Array.from(225 container.querySelectorAll<HTMLElement>('[role="option"]:not([aria-disabled="true"])'),226 );227}228229function focusOption(container: HTMLElement | null, value: string) {230 const options = getOptions(container);231 const selected = options.find((option) => option.dataset.value === value);232 (selected ?? options[0])?.focus();233}234235function focusOptionWhenShown(236 listRef: React.RefObject<HTMLElement | null>,237 value: string,238 attempts = 6,239) {240 requestAnimationFrame(() => {241 const list = listRef.current;242 focusOption(list, value);243 if (attempts > 0 && list && !list.contains(document.activeElement)) {244 focusOptionWhenShown(listRef, value, attempts - 1);245 }246 });247}248249const SelectRoot = ({250 children,251 value: controlledValue,252 defaultValue = '',253 onValueChange,254 open: controlledOpen,255 defaultOpen = false,256 onOpenChange,257 disabled = false,258 name,259 required,260 className,261}: SelectProps): React.JSX.Element => {262 const [value, setValue] = useControllableState({263 value: controlledValue,264 defaultValue,265 onChange: onValueChange,266 });267 const [isOpen, setOpen] = useControllableState({268 value: controlledOpen,269 defaultValue: defaultOpen,270 onChange: onOpenChange,271 });272 const [labels, setLabels] = React.useState<ReadonlyMap<string, string>>(() => new Map());273 const triggerRef = React.useRef<HTMLButtonElement>(null);274 const listRef = React.useRef<HTMLDivElement>(null);275 const layer = useLayer(isOpen, false, listRef);276277 const openMenu = React.useCallback(() => {278 if (!disabled) setOpen(true);279 }, [disabled, setOpen]);280281 const closeMenu = React.useCallback(282 (options?: { restoreFocus?: boolean }) => {283 setOpen(false);284 if (options?.restoreFocus !== false) triggerRef.current?.focus();285 },286 [setOpen],287 );288289 const toggleMenu = React.useCallback(() => {290 if (disabled) return;291 setOpen(!isOpen);292 }, [disabled, isOpen, setOpen]);293294 const selectValue = React.useCallback(295 (next: string) => {296 setValue(next);297 closeMenu();298 },299 [setValue, closeMenu],300 );301302 const registerItem = React.useCallback((itemValue: string, label: string) => {303 setLabels((prev) => {304 if (prev.get(itemValue) === label) return prev;305 const next = new Map(prev);306 next.set(itemValue, label);307 return next;308 });309 return () => {310 setLabels((prev) => {311 if (!prev.has(itemValue)) return prev;312 const next = new Map(prev);313 next.delete(itemValue);314 return next;315 });316 };317 }, []);318319 const id = React.useId();320 const triggerId = `select-trigger-${id}`;321 const contentId = `select-content-${id}`;322323 const contextValue = React.useMemo(324 () => ({325 value,326 selectValue,327 isOpen,328 openMenu,329 closeMenu,330 toggleMenu,331 disabled,332 labels,333 registerItem,334 triggerRef,335 listRef,336 triggerId,337 contentId,338 layer,339 }),340 [341 value,342 selectValue,343 isOpen,344 openMenu,345 closeMenu,346 toggleMenu,347 disabled,348 labels,349 registerItem,350 triggerId,351 contentId,352 layer,353 ],354 );355356 return (357 <SelectContext value={contextValue}>358 <div className={cn('relative w-full', className)}>359 {children}360 {(name || required) && (361 <input362 aria-hidden="true"363 tabIndex={-1}364 name={name}365 value={value}366 required={required}367 disabled={disabled}368 onChange={noop}369 onFocus={() => triggerRef.current?.focus()}370 className="pointer-events-none absolute start-0 bottom-0 h-px w-full opacity-0"371 />372 )}373 </div>374 </SelectContext>375 );376};377378const SelectTrigger = ({379 className,380 size,381 placeholder,382 children,383 onClick,384 onKeyDown,385 disabled: disabledProp,386 ref,387 ...props388}: SelectTriggerProps & { ref?: React.Ref<HTMLButtonElement> }): React.JSX.Element => {389 const {390 value,391 labels,392 isOpen,393 toggleMenu,394 openMenu,395 disabled,396 triggerRef,397 triggerId,398 contentId,399 listRef,400 closeMenu,401 layer,402 } = useSelectContext();403404 React.useImperativeHandle(ref, () => triggerRef.current as HTMLButtonElement);405406 const label = value ? labels.get(value) : undefined;407 const showPlaceholder = !label;408409 const handleClick = React.useCallback(410 (e: React.MouseEvent<HTMLButtonElement>) => {411 onClick?.(e);412 if (e.defaultPrevented) return;413 const opening = !isOpen;414 toggleMenu();415 if (opening) focusOptionWhenShown(listRef, value);416 },417 [onClick, toggleMenu, isOpen, listRef, value],418 );419420 const handleKeyDown = React.useCallback(421 (e: React.KeyboardEvent<HTMLButtonElement>) => {422 onKeyDown?.(e);423 if (e.defaultPrevented) return;424 if (isOpen && e.key === 'Escape') {425 if (!layer.isTopmost()) return;426 e.preventDefault();427 closeMenu();428 return;429 }430 if (isOpen && e.key === 'Tab') {431 closeMenu({ restoreFocus: false });432 return;433 }434 if (e.key === 'ArrowDown' || e.key === 'ArrowUp' || e.key === 'Enter' || e.key === ' ') {435 e.preventDefault();436 openMenu();437 focusOptionWhenShown(listRef, value);438 }439 },440 [onKeyDown, openMenu, closeMenu, isOpen, layer, listRef, value],441 );442443 return (444 <button445 ref={triggerRef}446 type="button"447 role="combobox"448 id={triggerId}449 aria-expanded={isOpen}450 aria-haspopup="listbox"451 aria-controls={isOpen ? contentId : undefined}452 data-placeholder={showPlaceholder}453 data-state={isOpen ? 'open' : 'closed'}454 disabled={disabled || disabledProp}455 onClick={handleClick}456 onKeyDown={handleKeyDown}457 className={cn(selectTriggerVariants({ size }), className)}458 {...props}459 >460 <span className="truncate">{children ?? label ?? placeholder ?? 'ย '}</span>461 <motion.span462 aria-hidden="true"463 variants={ICON_VARIANTS}464 animate={isOpen ? 'open' : 'closed'}465 transition={ICON_TRANSITION}466 style={ICON_STYLE}467 className="text-muted-foreground flex shrink-0"468 >469 <ChevronDownIcon size={16} className="size-4" />470 </motion.span>471 </button>472 );473};474475type ListboxName = { 'aria-labelledby': string } | { 'aria-label': string };476477function listboxNameFor(trigger: HTMLButtonElement | null, fallbackId: string): ListboxName {478 if (!trigger) return { 'aria-labelledby': fallbackId };479 const labelledBy = trigger.getAttribute('aria-labelledby');480 if (labelledBy) return { 'aria-labelledby': labelledBy };481 const label = trigger.getAttribute('aria-label') ?? trigger.labels?.[0]?.textContent?.trim();482 if (label) return { 'aria-label': label };483 return { 'aria-labelledby': trigger.id || fallbackId };484}485486const SelectContent = ({487 children,488 className,489 sideOffset = 4,490}: SelectContentProps): React.JSX.Element => {491 const {492 isOpen,493 closeMenu,494 selectValue,495 contentId,496 triggerId,497 triggerRef,498 listRef,499 labels,500 layer,501 } = useSelectContext();502 const shouldReduceMotion = useReducedMotion();503 const typeahead = useTypeahead();504 const [triggerWidth, setTriggerWidth] = React.useState<number>();505 const [name, setName] = React.useState<ListboxName>({ 'aria-labelledby': triggerId });506 const { style: floatingStyle, side } = useFloating({507 open: isOpen,508 anchorRef: triggerRef,509 floatingRef: listRef,510 side: 'bottom',511 align: 'start',512 sideOffset,513 });514 const position = side === 'top' ? 'top' : 'bottom';515516 const closeWithoutFocus = React.useCallback(517 () => closeMenu({ restoreFocus: false }),518 [closeMenu],519 );520521 useClickOutside(listRef, triggerRef, closeWithoutFocus, isOpen, layer.isInsideUpperLayer);522523 React.useLayoutEffect(() => {524 const trigger = triggerRef.current;525 setName(listboxNameFor(trigger, triggerId));526 if (!isOpen || !trigger) return;527 const measure = () => setTriggerWidth(trigger.offsetWidth || undefined);528 measure();529 const observer = typeof ResizeObserver === 'undefined' ? null : new ResizeObserver(measure);530 observer?.observe(trigger);531 return () => observer?.disconnect();532 }, [isOpen, triggerRef, triggerId]);533534 const handleKeyDown = React.useCallback(535 (e: React.KeyboardEvent<HTMLDivElement>) => {536 const options = getOptions(listRef.current);537 const currentIndex = options.findIndex((option) => option === document.activeElement);538539 if (540 e.key.length === 1 &&541 !e.altKey &&542 !e.ctrlKey &&543 !e.metaKey &&544 (e.key !== ' ' || typeahead.isTyping())545 ) {546 e.preventDefault();547 typeahead548 .search(549 e.key,550 options,551 currentIndex,552 (option) => labels.get(option.dataset.value ?? '') ?? option.textContent?.trim() ?? '',553 )554 ?.focus();555 return;556 }557558 switch (e.key) {559 case 'Escape':560 if (!layer.isTopmost()) return;561 e.preventDefault();562 closeMenu();563 return;564 case 'Tab':565 closeMenu();566 return;567 case 'ArrowDown':568 e.preventDefault();569 options[currentIndex < options.length - 1 ? currentIndex + 1 : 0]?.focus();570 return;571 case 'ArrowUp':572 e.preventDefault();573 options[currentIndex > 0 ? currentIndex - 1 : options.length - 1]?.focus();574 return;575 case 'Home':576 e.preventDefault();577 options[0]?.focus();578 return;579 case 'End':580 e.preventDefault();581 options[options.length - 1]?.focus();582 return;583 case 'Enter':584 case ' ': {585 e.preventDefault();586 const active = options[currentIndex];587 if (active?.dataset.value !== undefined) selectValue(active.dataset.value);588 return;589 }590 }591 },592 [listRef, closeMenu, selectValue, labels, layer, typeahead],593 );594595 const handleClick = React.useCallback(596 (e: React.MouseEvent<HTMLDivElement>) => {597 const option = (e.target as Element).closest<HTMLElement>('[role="option"]');598 if (!option || option.getAttribute('aria-disabled') === 'true') return;599 if (option.dataset.value !== undefined) selectValue(option.dataset.value);600 },601 [selectValue],602 );603604 const closedState = shouldReduceMotion605 ? { ...CONTENT_CLOSED[position], scale: 1, y: 0, transition: still }606 : CONTENT_CLOSED[position];607608 const style = React.useMemo(609 () => ({ ...floatingStyle, visibility: undefined, width: triggerWidth, ...CONTENT_STYLE }),610 [floatingStyle, triggerWidth],611 );612613 return (614 <FloatingPortal>615 <motion.div616 ref={listRef}617 id={contentId}618 role="listbox"619 {...name}620 aria-hidden={!isOpen}621 tabIndex={-1}622 onKeyDown={handleKeyDown}623 onClick={handleClick}624 initial={false}625 animate={626 isOpen627 ? shouldReduceMotion628 ? { ...CONTENT_OPEN, transition: still }629 : CONTENT_OPEN630 : closedState631 }632 style={style}633 className={cn(634 'bg-popover text-popover-foreground z-500 max-h-[min(18rem,var(--available-height,18rem))] overflow-y-auto overscroll-contain rounded-md p-1 shadow-md outline-none',635 floatingOrigin[position],636 !isOpen && 'pointer-events-none',637 className,638 )}639 inert={!isOpen}640 >641 {children}642 </motion.div>643 </FloatingPortal>644 );645};646647const SelectItem = ({648 value,649 children,650 textValue,651 disabled = false,652 className,653}: SelectItemProps): React.JSX.Element => {654 const { value: selectedValue, registerItem } = useSelectContext();655 const itemRef = React.useRef<HTMLDivElement>(null);656 const isSelected = selectedValue === value;657658 const staticLabel = textValue ?? (typeof children === 'string' ? children : undefined);659660 React.useLayoutEffect(() => {661 const label = staticLabel ?? itemRef.current?.textContent ?? '';662 return registerItem(value, label.trim());663 }, [value, staticLabel, registerItem]);664665 return (666 <div667 ref={itemRef}668 role="option"669 aria-selected={isSelected}670 aria-disabled={disabled || undefined}671 data-value={value}672 data-selected={isSelected}673 tabIndex={-1}674 className={cn(675 'relative flex cursor-pointer items-center gap-2 rounded-sm py-1.5 ps-2 pe-8 text-sm outline-none select-none',676 'transition-colors duration-150',677 'hover:bg-muted focus:bg-muted',678 disabled && 'pointer-events-none opacity-40',679 className,680 )}681 >682 <span className="flex-1 truncate">{children}</span>683 {isSelected && (684 <span className="absolute end-2 flex items-center" aria-hidden="true">685 <CheckIcon size={16} className="size-4" />686 </span>687 )}688 </div>689 );690};691692const SelectGroup = ({ children, className }: SelectGroupProps): React.JSX.Element => {693 const labelId = React.useId();694 const [labelCount, setLabelCount] = React.useState(0);695696 const registerLabel = React.useCallback(() => {697 setLabelCount((count) => count + 1);698 return () => setLabelCount((count) => count - 1);699 }, []);700701 const contextValue = React.useMemo(() => ({ labelId, registerLabel }), [labelId, registerLabel]);702703 return (704 <SelectGroupContext value={contextValue}>705 <div706 role="group"707 aria-labelledby={labelCount > 0 ? labelId : undefined}708 className={cn('flex flex-col', className)}709 >710 {children}711 </div>712 </SelectGroupContext>713 );714};715716const SelectLabel = ({ children, className }: SelectLabelProps): React.JSX.Element => {717 const group = React.use(SelectGroupContext);718 const registerLabel = group?.registerLabel;719720 React.useLayoutEffect(() => registerLabel?.(), [registerLabel]);721722 return (723 <div724 id={group?.labelId}725 role="presentation"726 className={cn('text-muted-foreground px-2 py-1.5 text-xs font-medium', className)}727 >728 {children}729 </div>730 );731};732733const SelectSeparator = ({ className }: SelectSeparatorProps): React.JSX.Element => (734 <div735 role="separator"736 aria-orientation="horizontal"737 className={cn('bg-border/50 my-1 h-px', className)}738 />739);740741const Select = Object.assign(SelectRoot, {742 Trigger: SelectTrigger,743 Content: SelectContent,744 Item: SelectItem,745 Group: SelectGroup,746 Label: SelectLabel,747 Separator: SelectSeparator,748});749750export { Select, selectTriggerVariants };751export type {752 SelectContentProps,753 SelectGroupProps,754 SelectItemProps,755 SelectLabelProps,756 SelectProps,757 SelectSeparatorProps,758 SelectTriggerProps,759};
Update the import paths to match your project structure.
Anatomy
1import { Select } from '@/components/select';
1<Select defaultValue="one">2 <Select.Trigger placeholder="Pick an option" />3 <Select.Content>4 <Select.Item value="one">Option 1</Select.Item>5 <Select.Item value="two">Option 2</Select.Item>6 </Select.Content>7</Select>
Composition
Use the following composition to build a
Select:Selectโโโ Select.Triggerโโโ Select.Contentโโโ Select.Groupโ โโโ Select.Labelโ โโโ Select.Itemโโโ Select.Separator
The trigger shows the label of the selected item on its own. Pass children to the trigger only when you want to render something else in its place.
Variants
Default
Grouped Items
Wrap related items in
Select.Group and give each group a Select.Label.1'use client';23import { Label } from '@/components/label';4import { Select } from '@/components/select';56const teams = [7 {8 label: 'Engineering',9 members: [10 { value: 'lucia', label: 'Lucia Mendez' },11 { value: 'marco', label: 'Marco Rivas' },12 { value: 'priya', label: 'Priya Nair' },13 ],14 },15 {16 label: 'Design',17 members: [18 { value: 'ines', label: 'Ines Duarte' },19 { value: 'tomas', label: 'Tomas Fuentes' },20 ],21 },22 {23 label: 'Support',24 members: [25 { value: 'noa', label: 'Noa Bergman' },26 { value: 'hugo', label: 'Hugo Salas' },27 ],28 },29];3031export function GroupedItems() {32 return (33 <div className="flex w-full max-w-sm flex-col gap-1.5">34 <Label htmlFor="assignee">Assign ticket to</Label>35 <Select>36 <Select.Trigger id="assignee" placeholder="Unassigned" />37 <Select.Content>38 {teams.map((team) => (39 <Select.Group key={team.label}>40 <Select.Label>{team.label}</Select.Label>41 {team.members.map((member) => (42 <Select.Item key={member.value} value={member.value}>43 {member.label}44 </Select.Item>45 ))}46 </Select.Group>47 ))}48 </Select.Content>49 </Select>50 </div>51 );52}
Keyboard
| Key | Action |
|---|---|
Enter, Space, Arrows | Open the list and focus the selected item |
ArrowUp, ArrowDown | Move between items |
Home, End | Jump to the first or last item |
| Typing | Focus the next item whose label starts with it |
Enter, Space | Select the focused item |
Escape | Close the list and return focus to the trigger |
Tab | Close the list and move on |
API Reference
Select
| Prop | Type | Default | Description |
|---|---|---|---|
value | string | - | Controlled value |
defaultValue | string | '' | Initial value when uncontrolled |
onValueChange | (value: string) => void | - | Called when the selected value changes |
open | boolean | - | Controlled open state |
defaultOpen | boolean | false | Initial open state when uncontrolled |
onOpenChange | (open: boolean) => void | - | Called when the open state changes |
disabled | boolean | false | Disables the trigger |
name | string | - | Renders a hidden input so the value submits with forms |
required | boolean | - | Blocks form submission until a value is picked |
className | string | - | Additional CSS classes for the wrapper |
Select.Trigger
Accepts every
button attribute, so id and aria-label work as usual. Name the trigger with aria-label, aria-labelledby or a <label htmlFor> pointing at its id. The open list reuses that name, so screen readers announce what the list is for instead of the current value.| Prop | Type | Default | Description |
|---|---|---|---|
placeholder | string | - | Text shown when no item is selected |
size | 'sm' | 'default' | 'lg' | 'default' | Height and padding of the trigger |
children | ReactNode | - | Replaces the selected label with custom content |
className | string | - | Additional CSS classes |
Select.Content
| Prop | Type | Default | Description |
|---|---|---|---|
sideOffset | number | 4 | Gap between the trigger and the list |
className | string | - | Additional CSS classes |
Select.Item
| Prop | Type | Default | Description |
|---|---|---|---|
value | string | - | Value reported when the item is selected |
textValue | string | - | Label shown in the trigger when children are not plain text |
disabled | boolean | false | Skips the item in keyboard navigation and blocks selection |
className | string | - | Additional CSS classes |
Select.Group, Select.Label, Select.Separator
| Prop | Type | Default | Description |
|---|---|---|---|
className | string | - | Additional CSS classes |
Found something to improve?
Notice a bug, typo, or missing detail on this page? Help us make the documentation better by opening a GitHub issue.