Overview
BasicSelector is a generic single-select dropdown. Built with the compound component pattern, it supports both controlled and uncontrolled modes.
- Compound — Composed of Root, Trigger, Content, Viewport, Value, Item
- Keyboard — Open with Enter/Space/ArrowDown, close with Escape
- Accessible —
role="combobox", role="listbox", role="option" applied
Use TagSelector and BadgeSelector for tag/badge selection respectively.
Basic Usage
Uncontrolled Mode
Custom Value Rendering
BasicSelector.Value shows, in order: the result of its render function, the label of the chosen option (once the list has opened), or the value itself. The list renders only while it is open, so when values and labels differ, pass a render function so the trigger shows the label from the start.
Sub-components
BasicSelector.Root
| Prop | Type | Default | Required | Description |
|---|
children | ReactNode | - | Yes | Trigger·Content(Viewport·Item) |
value | string | - | No | Chosen value (controlled) |
defaultValue | string | - | No | Initial value (uncontrolled) |
disabled | boolean | false | No | Disabled. The trigger does not open |
onValueChange | (value: string) => void | - | No | Called when a value is chosen |
onOpenChange | (open: boolean) => void | - | No | Called when it opens or closes |
BasicSelector.Trigger
| Prop | Type | Default | Required | Description |
|---|
children | ReactNode | - | Yes | What the trigger shows, usually Value |
ariaLabel | string | - | No | Accessible name of the combobox |
className | string | - | No | Extra CSS class |
BasicSelector.Content
| Prop | Type | Default | Required | Description |
|---|
position | 'item-aligned' | 'popover' | 'item-aligned' | No | Opens under the trigger at its width, or as a popover on a side |
side | 'top' | 'bottom' | 'left' | 'right' | 'bottom' | No | Side to open on in popover mode |
sideOffset | number | '0' | No | Gap from the trigger in px |
className | string | - | No | Extra CSS class |
children | ReactNode | - | Yes | Usually Viewport with Items |
BasicSelector.Viewport
| Prop | Type | Default | Required | Description |
|---|
children | ReactNode | - | Yes | Items |
className | string | - | No | Extra CSS class |
BasicSelector.Item
| Prop | Type | Default | Required | Description |
|---|
value | string | - | Yes | Value chosen by this option |
disabled | boolean | false | No | Disabled option |
children | ReactNode | - | Yes | Option label |
className | string | - | No | Extra CSS class |
BasicSelector.Value
| Prop | Type | Default | Required | Description |
|---|
placeholder | string | - | No | Shown when nothing is chosen |
children | (value: string) => ReactNode | - | No | Maps the value to what the trigger shows. Without it, the chosen option label (after the list has opened) or the value itself |
States
| Part | State | Look |
|---|
| Trigger | Hover | Hover background |
| Trigger | Keyboard focus | Focus ring outside the trigger |
| Trigger | Disabled | Disabled background, border, text and chevron colors |
| Item | Selected | Check icon on the right (aria-selected="true"), no color change |
| Item | Hover / keyboard focus | Hover background (focus also shows the ring inside) |
| Item | Disabled | Disabled text color |
The selected item is marked with a check icon, not a background color, so it is visible without relying on color.
Specification
base
| 상태 | 요소 | 속성 | 값 |
|---|
| enabled | trigger | paddingX | $size.space.200 |
| enabled | trigger | paddingY | $size.space.100 |
| enabled | trigger | gap | $size.space.200 |
| enabled | trigger | borderRadius | $size.radius.200 |
| enabled | trigger | borderWidth | $size.stroke.border |
| enabled | trigger | borderColor | $color.border.default.default |
| enabled | trigger | backgroundColor | $color.background.default.default |
| enabled | trigger | typography | $text.bodyBase |
| enabled | trigger | color | $color.text.default.default |
| enabled | trigger | minWidth | 200px토큰 아님 — no sizing token scale |
| enabled | content | borderRadius | $size.radius.200 |
| enabled | content | borderWidth | $size.stroke.border |
| enabled | content | borderColor | $color.border.default.default |
| enabled | content | backgroundColor | $color.background.default.default |
| enabled | item | paddingX | $size.space.300 |
| enabled | item | paddingY | $size.space.200 |
| enabled | item | borderRadius | $size.radius.100 |
| enabled | item | typography | $text.singleLine.bodyBase |
| enabled | item | color | $color.text.default.default |
| enabled | check | color | $color.icon.default.default |
| hover | trigger | backgroundColor | $color.background.default.defaultHover |
| hover | item | backgroundColor | $color.background.default.defaultHover |
| focusVisible | trigger | outlineWidth | $size.stroke.focus |
| focusVisible | trigger | outlineStyle | solid토큰 아님 — no line style token |
| focusVisible | trigger | outlineColor | $color.border.focus.default |
| focusVisible | trigger | outlineOffset | 2px토큰 아님 — no ring offset token |
| disabled | trigger | backgroundColor | $color.background.disabled.default |
| disabled | trigger | borderColor | $color.border.disabled.default |
| disabled | trigger | color | $color.text.disabled.default |
| disabled | item | color | $color.text.disabled.default |
Guidelines
- Consider ToggleMenu for 3 or fewer options
- Always specify
ariaLabel to ensure accessibility