# ComboBox
A combination of a text input and dropdown that allows typing to filter options.
## Usage
Use standalone, or inside `Pagination`.
```svelte
{#each options as option}
```
## Props
| Name | Type | Default | Description |
| ---------- | ------------------ | --------- | ----------------------------------------------------------------------- |
| `options` | `SvelteSet` | - | Values displayed as selectable options; empty options prevent rendering |
| `extra` | `Snippet` | - | Extra content; receives expanded state and variant |
| `value` | `string` | - | Bindable input value |
| `expanded` | `boolean` | - | Bindable listbox open state |
| `search` | `boolean` | `true` | Enables forward-matching search; set false for very large option sets |
| `cssvar` | `object` | - | Custom-property names for the listbox x/y offsets and z-index; absent key uses the default name |
| `attach` | `Attachment` | - | Svelte attachment on the input |
| `element` | `HTMLInputElement` | - | Bindable input element |
| `styling` | `SVSClass` | - | Styling override |
| `variant` | `SVSVariant` | `NEUTRAL` | Variant |
Other `HTMLInputAttributes` are passed to `` via rest props; `class` is merged onto the root.
## Styling
To learn more, see [Styling](/docs/styling).
### Variant Management
The currently selected option will apply the `active`. `ul` element as `bottom` (listbox) will apply the `active` when expanded. Others are not automatically switched.
### Default Class Name
`svs-combo-box`
## Behavior
- When embedded in a `ComboBoxContext`, `options`, `value`, `variant`, and fallback `styling` come from the context.
- Closing the listbox invokes the context's `commit` hook when present.
- The `whole` wrapper is `position:relative;display:inline-block;` because the listbox anchors against it; a caller overriding its `display` owns the resulting anchor geometry.
- The listbox defaults below/left, flips per axis above/right on viewport overflow, exposes `data-svs-flip-x` / `data-svs-flip-y` on flipped axes, and reads its offsets from `cssvar` x/y custom properties (defaults `--svs-position-x` / `--svs-position-y`).
- The listbox carries `z-index: var(--svs-position-z, 1)` so it paints above adjacent positioned content. Override it from caller CSS or rename it via the `cssvar` z key to fit a caller's own stacking order.
Open/close animations should be layered on the `bottom` part variant classes (`active` = open) with opacity, transform, or scale; the component keeps `visibility` as its structural default.
## Accessibility
### Keyboard Interactions
| Key | Description |
| --- | --- |
| `ArrowDown` | When closed, opens the listbox and highlights the current value if it is one of the options, otherwise the first option; when open, moves the highlight down one option |
| `ArrowUp` | When closed, opens the listbox and highlights the current value if it is one of the options, otherwise the last option; when open, moves the highlight up one option |
| `Alt` + `ArrowDown` | Opens the listbox, highlighting the current value if it is one of the options (otherwise no option is highlighted) |
| `Alt` + `ArrowUp` | Closes the open listbox |
| `Enter` | Selects the highlighted option, fills the input, and closes the listbox |
| `Escape` | Closes the open listbox |
Typing filters the options by forward match (see the `search` prop).
### ARIA Roles and Attributes
The component applies these automatically:
- Input (`main`): `role="combobox"`, `aria-haspopup="listbox"`, `aria-autocomplete="list"`, `aria-controls` (the listbox), `aria-expanded` (open state), and `aria-activedescendant` (the highlighted option).
- Listbox (`bottom` `