form-field — wyrd.component.combobox

Combobox

Single-select autocomplete field with popup suggestions, canonical selected value, and component-owned empty-state localization.

Install @wyrd-company/react or the Flutter package and use it directly — your DESIGN.md does the styling.

01

Examples

Generated from the contract's examples block. Previews are the published @wyrd-company/react component, themed by the brand's role tokens — flip the site's light/dark toggle and they follow.

Code target Applies to every example on component pages.
empty state: closed
Usage
import { WyrdCombobox } from "@wyrd-company/react";

<WyrdCombobox placeholder="Choose a spell" options={[{"value":"light","label":"Light"},{"value":"shield","label":"Shield"},{"value":"misty-step","label":"Misty Step"}]} label="Spell" description="Pick the prepared spell to cast." />

// events: onValueChange, onOpenChange, onOptionSelect
selected state: selected
Usage
import { WyrdCombobox } from "@wyrd-company/react";

<WyrdCombobox defaultValue="shield" options={[{"value":"light","label":"Light"},{"value":"shield","label":"Shield"},{"value":"misty-step","label":"Misty Step"}]} label="Spell" />

// events: onValueChange, onOpenChange, onOptionSelect
no-options state: open
Usage
import { WyrdCombobox } from "@wyrd-company/react";

<WyrdCombobox isOpen options={[]} label="Spell" description="The popup shows the localized empty state when the typed filter has no matches." />

// events: onValueChange, onOpenChange, onOptionSelect
02

Properties

NameTypeDefaultSummary
value string undefined Controlled selected option value; free-text values are not accepted.
default-value string undefined Initial uncontrolled selected option value.
options array Ordered selectable option items; disabled items render but are skipped by navigation and activation.
placeholder string undefined Placeholder text shown when no option is selected and no filter text is entered.
is-open boolean false Controlled suggestion popup visibility.
default-open boolean false Initial uncontrolled suggestion popup visibility.
is-disabled boolean false Prevents text editing, popup opening, and option activation.
is-required boolean false Marks the field as requiring one selected option.
is-invalid boolean false Marks the selection as invalid and associates the error slot.
active-index integer 0 Initial active suggestion index when the popup opens.
03

Slots & events

SlotCardinalityAcceptsSummary
label exactly-one text Visible label and accessible-name source.
description zero-or-one text Help text associated with the input.
error zero-or-one text Validation error associated when is-invalid is true.
EventPayloadSummary
value-change value, action Canonical value-change event carrying the selected option value.
open-change is-open, reason Canonical suggestion popup visibility event.
option-select index, value, action Canonical suggestion activation event emitted once per accepted selection.
04

Tokens

The contract's token bindings. Open the shared contextual sidebar from any example; primary swatches reflect the color you pick there. Error swatches show the active preset's values; editing any knob switches to custom and resets error to TWW · Ink.

BindingToken
root.gap spacing.xs
label.color color.on-surface
label.text typography.label-md
input.background color.surface
input.foreground color.on-surface
input.placeholder color.on-surface-variant
input.border-color color.outline
input.border-color-focus color.primary
input.border-color-invalid color.error
input.border-width 1px
input.radius rounded.sm
input.padding-x spacing.md
input.padding-y spacing.sm
input.text typography.body-md
popup.background color.surface-container
popup.foreground color.on-surface
popup.border-color color.outline
popup.radius rounded.md
popup.shadow shadow.md
popup.padding-y spacing.xs
option.foreground color.on-surface
option.foreground-active color.on-primary
option.background-hover color.secondary
option.background-active color.primary-hover
option.background-selected color.secondary
option.padding-x spacing.md
option.padding-y spacing.sm
empty-state.foreground color.on-surface-variant
empty-state.padding-x spacing.md
empty-state.padding-y spacing.sm
description.color color.on-surface-variant
description.text typography.body-md
error.color color.error
error.text typography.body-md
05

States

StateSourceSummary
closed behavior-runtime Suggestion popup is not visible.
open behavior-runtime Suggestion popup is visible.
focused platform Text input owns focus.
selected property State when value or default-value matches an option.
disabled property Disabled state derived from is-disabled.
invalid property Invalid state derived from is-invalid.
required property Required state derived from is-required.
06

Accessibility

From the contract's accessibility obligations. Role combobox; Label slot provides the accessible name.

  • Text input follows platform editing keys.
  • ArrowDown and ArrowUp open suggestions and move the active option, skipping disabled options.
  • Enter accepts the active enabled option when the popup is open.
  • Escape closes the popup without changing the selected value.
  • Tab leaves the field and closes the popup.
  • Input exposes combobox, expanded, autocomplete=list, aria-controls, and aria-activedescendant semantics on web.
  • Web listbox and option IDREF targets must live in the same root as the input.
  • Required, invalid, and disabled states are exposed through platform semantics.
  • Error text is associated only when invalid.
  • Verified under: rtl, reduced-motion, cvd-deuteranopia, density-compact, text-expansion, keyboard-inset.
07

SDUI

Status: serializable. Option data, selected value, and open state serialize; popup positioning, focus, filtering query, and keyboard host effects remain target-local.

SerializableMembers
Propertiesvalue, default-value, options, placeholder, is-open, default-open, is-disabled, is-required, is-invalid, active-index
Slotslabel, description, error
Eventsvalue-change, open-change, option-select
The Wyrding Way — a contract-first design system. © Wyrd Company