Aliases
dropdown
components / select
Field-shell trigger and single-select listbox built on DK overlays and list navigation.
Playground
Start here. Switch systems, interact with the shipped component, and let the rest of the page answer the why and how after the behavior clicks.
Cobalt
The crisp default DK action system: bright primary, roomy spacing, and a direct editorial rhythm.
Overview
This section explains the intent of the component before the implementation details.
Aliases
dropdown
Explore the math
Decision guide
Use these notes to decide quickly whether this is the right DK component for the job.
Decision guide
Do
Do not
Usage
Prefer these situations when choosing this component.
Usage
These patterns are better served by a different component or a simpler surface.
Anti-patterns
Migration notes
Anatomy
The anatomy explains which pieces matter to the recipe and accessibility model.
field wrapper
rootProvides the label, helper text, and validation shell.
field button
triggerOpens the listbox and reflects the current value.
options surface
listboxAnchored list of available options.
selectable row
optionSingle option row with label and optional description.
API
The docs contract distinguishes props, DOM events, and slots so integration behavior is explicit.
Props
| Name | Type | Default | Description |
|---|---|---|---|
value | string | — | Controlled selected value. |
items | Array<{ value: string; label: string; description?: string; disabled?: boolean }> | — | Available options. |
label | string | — | Visible field label. |
description | string | — | Supporting helper copy. |
error | string | — | Validation message. |
placeholder | string | — | Text shown before a selection is made. |
required | boolean | false | Marks the field as required. |
disabled | boolean | false | Disables the field. |
name | string | — | Native form field name. |
id | string | — | Optional field id. |
size | 'sm' | 'md' | 'lg' | 'md' | Chooses the size recipe. |
onChange | (detail: { value: string | undefined }) => void | — | Callback fired when a value is selected. |
theme | ThemeContract | — | Overrides the compiled DK theme used to resolve tokens and recipes for this component. |
Events
| Name | Payload | Description |
|---|---|---|
change | { value: string | undefined } | Fires when the component commits a new value. |
Slots
| Name | Description |
|---|---|
default | Select is data-driven in v1 and does not expose custom option slots. |
Recipes
These notes summarize the intended recipe surface rather than exposing raw implementation detail first.
Variants
Sizes
States
Accessibility
This is the behavior the component promises to assistive tech and keyboard users today.
Semantics
Keyboard
Screen readers
Checklist
Implementation
This section shows the representative compiled slot variables that the runtime consumes for the selected design system.
Implementation notes
Implementation checklist
Examples
Each example is intentionally practical, grouped by starter, common pattern, and edge-case coverage.
Starter
1 example
starter
Starter: environment selectorA standard single-select field.
Copy snippet
<Select label="Environment" description="Choose the deployment target." placeholder="Select an environment" items={items} />Common patterns
1 example
common
Common: required selectionUse the error prop when the selection is mandatory.
Copy snippet
<Select label="Environment" error="Please choose an environment." placeholder="Select an environment" items={items} />Edge cases
1 example
edge
Edge: externally controlled listboxControl the selected value when surrounding state owns the workflow.
Copy snippet
<Select label="Environment" items={items} value={selectedEnvironment} onChange={(detail) => selectedEnvironment = detail.value} />Verification
Proofs stay visible in the docs so the system shows what it can guarantee, not just what it can render.
size=sm
size=md
size=lg
size=sm
size=md
size=lg
size=sm
size=md
size=lg