Listbox root
RequiredHeadless UI state and semantic owner.
Fields & selection
An accessible controlled listbox for choosing one option in compact space.
DropdownDropdownPropsDropdownOptionConfigure the production component, inspect it at responsive widths, copy synchronized JSX, and share the exact state from one workspace.
This JSX stays synchronized with the controls and uses only public package APIs.
'use client';
import { useState } from 'react';
import { Dropdown } from '@ai-created/ui';
const options = [
{ value: 'recent', label: 'Most recent' },
{ value: 'name', label: 'Name' },
{ value: 'status', label: 'Status' },
];
export function Example() {
const [value, setValue] = useState("recent");
return (
<Dropdown
options={options}
value={value}
onChange={setValue}
label={"Sort by"}
/>
);
}
import { Dropdown, type DropdownOption } from '@ai-created/ui';Client boundary
'use client' to the file that owns this interactive state.Replace the version placeholder with the release tag your product has reviewed.
npm install --install-links "git+https://github.com/TheMarco/ai-created-ui.git#vX.Y.Z"@import '@ai-created/ui/styles/tokens.css';
@tailwind base;
@tailwind components;
@tailwind utilities;module.exports = {
presets: [require('@ai-created/ui/tailwind-preset')],
content: [
'./src/**/*.{js,ts,jsx,tsx,mdx}',
'./node_modules/@ai-created/ui/src/**/*.{js,ts,jsx,tsx}',
],
};Named regions define what belongs to the component, what remains optional, and where semantic responsibility lives.
Headless UI state and semantic owner.
Persistent visible listbox name.
Current selection or placeholder and disclosure icon.
buttonAnchored, scrollable list of values.
Selectable row with optional check marker and disabled state.
The Figma-equivalent asset model, auto-layout, resizing, properties, slots, content bounds, localization, and governance contract.
Asset kind
component
Design library name
Components/Forms/Dropdown
Maturity
stable
Last reviewed
2026-08-29
Canvas applicability
Publish closed and open variants with nested option instances and selected state.
| Property | Type | Default | Code mapping | Options or notes |
|---|---|---|---|---|
| LabelRequired | text | Sort by | Required label; canvas example only | No additional constraint |
| Content previewRequired | variant | placeholder | Whether value resolves to a selected option | placeholder, selected |
| Text (exposed Trigger) | text | Select an option | placeholder or selected option label; selected preview defaults to Most recent | No additional constraint |
| State preview | variant | default | Native hover/focus-visible, disabled boolean and internal Headless UI open state | default, hover, focus-visible, disabled, disabled-hover, open |
| OptionsRequired | slot | None | options; edit attached option rows inside Options panel | No additional constraint |
Accessible field label.
ListboxLabelCurrent value and chevron button.
ListboxButtonAnchored, scrollable menu.
ListboxOptionsRepeatable selected, active, or disabled row.
DropdownOption data itemOverflow: Use search or autocomplete for larger datasets.
A long unfiltered list is inefficient.
Overflow: Truncate visually only when the full value is otherwise available.
Menu scanning depends on concise parallel labels.
Translatable: Label, Placeholder, Option labels
Trigger fills its form column; menu matches trigger width.
No internal breakpoint
Accountable owner
Design systems form foundations owner
Canonical source: src/components/Dropdown.tsx
These measurements and semantic tokens define the supported visual contract. Local overrides should preserve the same hierarchy and interaction cues.
Label-to-trigger gap
10px
Trigger padding
20px left / 50px right / 15px vertical
Option padding
50px left / 20px right / 15px vertical
Radius
6px
Panel maximum height
300px
Panel offset
5px
Icons
20 × 20px
--color-surface2Trigger and active option background.
--color-surfaceOptions panel.
--color-control-border / --color-control-border-strongTrigger resting and hover boundaries.
--color-borderOptions panel border.
--color-focusTrigger focus outline.
--color-accentSelected check marker.
--shadow-elevation-medium / --layer-dropdownOptions elevation and stacking.
A component is not complete until its passive, interactive, disabled, and exceptional states remain understandable in both themes.
Semantics, accessible naming, keyboard behavior, focus and announcements are implementation requirements, not optional documentation.
Use the public package API and preserve the controlled-state, native-attribute, and ref contracts described below.
import { Dropdown, type DropdownOption } from '@ai-created/ui';Client Component required
<Dropdown options={options} value={sort} onChange={setSort} label="Sort by" />These props and helpers are compatibility contracts. Changes require migration guidance and release notes.
| Prop | Type | Default | Contract |
|---|---|---|---|
| options | DropdownOption<T>[] | required | Options with value, label, and optional disabled. |
| value | T | required | Controlled selected value. |
| onChange | (value: T) => void | required | Called on selection. |
| label | string | required | Listbox label. |
| placeholder | string | Select an option | Fallback text. |
| disabled | boolean | false | Disables the listbox. |
These rules keep the component recognizable across products without preventing deliberate composition.
The component should be verified as rendered UI, an interaction model, an accessibility surface, and a theme-aware visual artifact.