An input that allows users to filter and select a value from a list of suggestions.
Loading...
Installation
Install the following dependencies:
Copy and paste the following code into your project.
Loading...
Update the import paths to match your project setup.
Composition
<app-combobox> ├── [app-combobox-label] (optional) ├── <app-combobox-input> | <app-combobox-trigger> ├── [app-combobox-tags-control] (multiple selection) │ ├── <app-combobox-tag> │ └── <input app-combobox-tags-input> └── <app-combobox-content> ├── <app-combobox-input> (optional, with a button trigger) ├── [app-combobox-empty] (optional) └── [app-combobox-list] ├── [app-combobox-item-group] │ ├── [app-combobox-item-group-label] │ └── <app-combobox-item> └── [app-combobox-separator] (optional)
Examples
Button Trigger
Loading...
Default
Loading...
Groups
Loading...
Multiple Selection
Loading...
Single Selection
Loading...
Sizes
Loading...
With Description
Loading...
API Reference
<app-combobox>
Inputs
| Input | Type | Default | Description |
|---|---|---|---|
collection | ListCollection<T> | required | Collection that supplies the items, values, and display strings. |
id | string | undefined | generated | Unique identifier used to create the combobox part IDs. |
ids | ComboboxElementIds | undefined | — | Overrides the generated IDs for individual parts. |
value | string[] | undefined | — | Selected values when controlled. Supports Angular two-way binding. |
defaultValue | string[] | undefined | [] | Initially selected values when uncontrolled. |
inputValue | string | undefined | — | Input text when controlled. Supports Angular two-way binding. |
defaultInputValue | string | undefined | "" | Initial input text when uncontrolled. |
open | boolean | undefined | — | Open state when controlled. Supports Angular two-way binding. |
defaultOpen | boolean | false | Initial open state when uncontrolled. |
highlightedValue | string | null | undefined | — | Highlighted item value when controlled. Supports Angular two-way binding. |
defaultHighlightedValue | string | null | undefined | — | Initially highlighted item value when uncontrolled. |
multiple | boolean | false | Allows more than one value to be selected. |
disabled | boolean | false | Disables interaction with the combobox. |
invalid | boolean | false | Marks the associated form control as invalid. |
readOnly | boolean | false | Prevents changes while preserving focus and navigation. |
required | boolean | false | Marks the associated form control as required. |
allowCustomValue | boolean | false | Allows values that are not present in the collection. |
autoFocus | boolean | false | Focuses the input when the component initializes. |
openOnClick | boolean | false | Opens the suggestions when the input is clicked. |
openOnKeyPress | boolean | undefined | true | Controls whether typing or navigation keys open the suggestions. |
alwaysSubmitOnEnter | boolean | false | Allows Enter to submit the containing form when no item is selected. |
closeOnSelect | boolean | undefined | !multiple | Controls whether the suggestions close after a selection. |
loopFocus | boolean | undefined | true | Controls whether keyboard focus wraps through the items. |
composite | boolean | undefined | true | Enables composite-widget keyboard navigation. |
disableLayer | boolean | undefined | — | Disables the dismissable layer used by the floating content. |
inputBehavior | "autohighlight" | "autocomplete" | "none" | undefined | "none" | Controls how input text affects the highlighted suggestion. |
selectionBehavior | "clear" | "replace" | "preserve" | undefined | multiple ? "clear" : "replace" | Controls how the input text changes after selection. |
openOnChange | boolean | ((details: ComboboxInputValueChangeDetails) => boolean) | undefined | true | Controls whether an input-value change opens the suggestions. |
placeholder | string | undefined | — | Placeholder used by the combobox state machine. |
name | string | undefined | — | Name used when submitting the selected values with a form. |
form | string | undefined | — | Associates the control with a form by ID. |
positioning | ComboboxPositioningOptions | undefined | — | Configures floating-content placement and collision handling. |
scrollToIndexFn | ((details: ComboboxScrollToIndexDetails) => void) | undefined | — | Customizes scrolling when the highlighted item changes. |
navigate | ((details: ComboboxNavigateDetails) => void) | null | undefined | — | Handles navigation for items that represent links. |
translations | ComboboxIntlTranslations | undefined | — | Overrides accessible labels used by the component. |
Use [(value)]="selected", [(inputValue)]="query", [(open)]="open", or
[(highlightedValue)]="highlighted" for two-way binding. The component also implements Angular's
ControlValueAccessor for forms integration.
Outputs
| Output | Type | Description |
|---|---|---|
valueChange | string[] | undefined | Emits the current selected values. |
inputValueChange | string | undefined | Emits the current input text. |
openChange | boolean | undefined | Emits the current open state. |
highlightedValueChange | string | null | undefined | Emits the current highlighted item value. |
valueChangeDetails | ComboboxValueChangeDetails<T> | Emits details whenever the selected values change. |
inputValueChangeDetails | ComboboxInputValueChangeDetails | Emits details whenever the input text changes. |
highlightChange | ComboboxHighlightChangeDetails<T> | Emits details whenever the highlighted item changes. |
openChangeDetails | ComboboxOpenChangeDetails | Emits details whenever the open state changes. |
select | ComboboxSelectionDetails | Emits when an item is selected. |
focusOutside | ComboboxFocusOutsideEvent | Emits when focus moves outside the floating layer. |
pointerDownOutside | ComboboxPointerDownOutsideEvent | Emits when a pointer is pressed outside the floating layer. |
interactOutside | ComboboxInteractOutsideEvent | Emits when an interaction occurs outside the floating layer. |
<app-combobox-input>
Inputs
| Input | Type | Default | Description |
|---|---|---|---|
id | string | undefined | — | ID applied to the generated input element. |
placeholder | string | "" | Placeholder displayed by the input. |
disabled | boolean | false | Disables the input and its generated controls. |
showTrigger | boolean | true | Shows the generated dropdown trigger. |
showClear | boolean | false | Shows the generated clear trigger. |
size | "default" | "lg" | "xl" | "default" | Sets the input-group size. |
<app-combobox-item>
Inputs
| Input | Type | Default | Description |
|---|---|---|---|
item | T | required | Collection item represented by this option. |
persistFocus | boolean | undefined | — | Preserves visual focus while interacting with the option. |
[app-combobox-item-group]
Inputs
| Input | Type | Default | Description |
|---|---|---|---|
id | string | undefined | generated | Identifier shared with the group label. |
<app-combobox-tag>
Inputs
| Input | Type | Default | Description |
|---|---|---|---|
value | string | required | Selected value represented by the tag. |
removable | boolean | false | Shows a button for dismissing the selected value. |
Outputs
| Output | Type | Description |
|---|---|---|
remove | string | Emits the tag value when its remove button is activated. |
Context, Providers, and Utilities
| Export | Angular API |
|---|---|
ComboboxRootProvider | Directive that provides an externally created combobox API through value. |
ComboboxContext | Structural directive [combobox-context] exposing the root API to a template. |
ComboboxItemContextDirective | Structural directive [combobox-item-context] exposing the current item state. |
useCombobox(options) | Creates the signal-backed combobox machine inside an Angular injection context. |
injectComboboxContext() | Injects the nearest root combobox context. |
injectComboboxItemContext() | Injects the nearest item context. |
injectComboboxItemGroupContext() | Injects the nearest item-group context. |
createListCollection(options) | Creates the typed collection consumed by the combobox. |
useListCollection(options) | Creates and manages a signal-backed list collection. |
ComboboxImports | Readonly collection containing the combobox UI and context helpers. |
Types
| Export | Description |
|---|---|
ComboboxApi | Connected combobox state and actions. |
ComboboxElementIds | Overrides for generated combobox part IDs. |
ComboboxValueChangeDetails<T> | Details emitted by valueChangeDetails. |
ComboboxInputValueChangeDetails | Details emitted by inputValueChangeDetails. |
ComboboxHighlightChangeDetails<T> | Details emitted by highlightChange. |
ComboboxOpenChangeDetails | Details emitted by openChangeDetails. |
ComboboxSelectionDetails | Details emitted by select. |
UseComboboxReturn<T> | Signal-backed combobox machine returned by useCombobox. |
Angular
React
Solid
Svelte
Vue