# Combobox

A native chooser in a Themes card, with query, accepted key and actual submission visible.

```tsx
() => <Card style={{ width: "min(100%, 480px)" }}>

  <ComboboxDemo />

</Card>
```

Choose Paris with arrows and Enter, then submit the form. Enter commits a suggestion without submitting. Type a different draft: the accepted key can still read `paris`, but it is not a successful form field. Both the submit button and `requestSubmit()` validate the focusable input. Clear explicitly removes the key.

Turn off **Accept value proposals** to observe parent refusal, or remove Paris from the data after accepting it. Key, query and submitted output are deliberately separate. Prevent reset to see that cancelled reset does not clear the draft; otherwise reset requests the initial null/empty state. No application-side filtering, focus navigation or synthetic hidden-field workaround is used.

The accepted-state readouts use non-resettable elements with `role="status"`. Native form reset replaces the children of form-associated `<output>` elements, including reactive rendering markers. Keep these display-only readouts non-resettable (or outside the reset form); do not intercept reset or rewrite the accepted query to repair the display.

The input defaults to HTML `autocomplete="off"` so browser form-history suggestions do not compete with this custom list or consume Enter before it reaches the list. Leave that default in this recipe. It is consumer-overridable, including through a target factory, and is distinct from the input's `aria-autocomplete="list"` accessibility semantics.

## External form ownership

Root `form` associates both native validation and the successful key field. Use a unique form ID in your application. This optional external example is independent of the required booking form above.

```tsx
() => <Box>

  <form id="external-destination-form" aria-label="External destination form" onSubmit={event => event.preventDefault()}>

    <Button type="submit">Submit external destination</Button>

  </form>

  <Combobox.Root items={[{ value: "oslo", label: "Oslo" }]} defaultValue="oslo" name="externalDestination" form="external-destination-form">

    <Combobox.Input aria-label="External destination" />

    <Combobox.Clear aria-label="Clear external destination">Clear</Combobox.Clear>

  </Combobox.Root>

</Box>
```

Read-only is not a required-validation substitute: native read-only inputs are barred from constraint validation, though unresolved keys still cannot submit. Always validate authorization and accepted keys on the server.

See the [complete API and three standalone styling downloads](/primitives/docs/components/combobox), including data labels, controlled reconciliation, IME, SSR and focus behavior. This recipe requires the published Primitives `0.1.0-rc.4` release candidate, not historical rc.2; use the exact-version [npm installation instructions](/themes/docs/overview/getting-started).
