@@ -32,6 +32,33 @@ import {Directionality} from '@angular/cdk/bidi';
3232import { toSignal } from '@angular/core/rxjs-interop' ;
3333
3434/**
35+ * The container element that wraps a combobox input and popup, and orchestrates its behavior.
36+ *
37+ * The `ngCombobox` directive is the main entry point for creating a combobox and customizing its
38+ * behavior. It coordinates the interactions between the `ngComboboxInput` and the popup, which
39+ * is defined by a `ng-template` with the `ngComboboxPopupContainer` directive. If using the
40+ * `CdkOverlay`, the `cdkConnectedOverlay` directive takes the place of `ngComboboxPopupContainer`.
41+ *
42+ * ```html
43+ * <div ngCombobox filterMode="highlight">
44+ * <input
45+ * ngComboboxInput
46+ * placeholder="Search for a state..."
47+ * [(value)]="searchString"
48+ * />
49+ *
50+ * <ng-template ngComboboxPopupContainer>
51+ * <div ngListbox [(value)]="selectedValue">
52+ * @for (option of filteredOptions(); track option) {
53+ * <div ngOption [value]="option" [label]="option">
54+ * <span>{{option}}</span>
55+ * </div>
56+ * }
57+ * </div>
58+ * </ng-template>
59+ * </div>
60+ * ```
61+ *
3562 * @developerPreview 21.0
3663 */
3764@Directive ( {
@@ -70,7 +97,12 @@ export class Combobox<V> {
7097 /** The combobox popup. */
7198 readonly popup = contentChild < ComboboxPopup < V > > ( ComboboxPopup ) ;
7299
73- /** The filter mode for the combobox. */
100+ /**
101+ * The filter mode for the combobox.
102+ * - `manual`: The consumer is responsible for filtering the options.
103+ * - `auto-select`: The combobox automatically selects the first matching option.
104+ * - `highlight`: The combobox highlights matching text in the options without changing selection.
105+ */
74106 filterMode = input < 'manual' | 'auto-select' | 'highlight' > ( 'manual' ) ;
75107
76108 /** Whether the combobox is disabled. */
@@ -88,7 +120,7 @@ export class Combobox<V> {
88120 // TODO: Maybe make expanded a signal that can be passed in?
89121 // Or an "always expanded" option?
90122
91- /** Whether the combobox popup is always expanded. */
123+ /** Whether the combobox popup should always be expanded, regardless of user interaction . */
92124 readonly alwaysExpanded = input ( false ) ;
93125
94126 /** Input element connected to the combobox, if any. */
@@ -145,6 +177,21 @@ export class Combobox<V> {
145177}
146178
147179/**
180+ * An input that is part of a combobox. It is responsible for displaying the
181+ * current value and handling user input for filtering and selection.
182+ *
183+ * This directive should be applied to an `<input>` element within an `ngCombobox`
184+ * container. It automatically handles keyboard interactions, such as opening the
185+ * popup and navigating through the options.
186+ *
187+ * ```html
188+ * <input
189+ * ngComboboxInput
190+ * placeholder="Search..."
191+ * [(value)]="searchString"
192+ * />
193+ * ```
194+ *
148195 * @developerPreview 21.0
149196 */
150197@Directive ( {
@@ -193,6 +240,33 @@ export class ComboboxInput {
193240}
194241
195242/**
243+ * A structural directive that marks the `ng-template` to be used as the popup
244+ * for a combobox. This content is conditionally rendered.
245+ *
246+ * The content of the popup can be a `ngListbox`, `ngTree`, or `role="dialog"`, allowing for
247+ * flexible and complex combobox implementations. The consumer is responsible for
248+ * implementing the filtering logic based on the `ngComboboxInput`'s value.
249+ *
250+ * ```html
251+ * <ng-template ngComboboxPopupContainer>
252+ * <div ngListbox [(value)]="selectedValue">
253+ * <!-- ... options ... -->
254+ * </div>
255+ * </ng-template>
256+ * ```
257+ *
258+ * When using CdkOverlay, this directive can be replaced by `cdkConnectedOverlay`.
259+ *
260+ * ```html
261+ * <ng-template
262+ * [cdkConnectedOverlay]="{origin: inputElement, usePopover: 'inline' matchWidth: true}"
263+ * [cdkConnectedOverlayOpen]="combobox.expanded()">
264+ * <div ngListbox [(value)]="selectedValue">
265+ * <!-- ... options ... -->
266+ * </div>
267+ * </ng-template>
268+ * ```
269+ *
196270 * @developerPreview 21.0
197271 */
198272@Directive ( {
@@ -203,6 +277,13 @@ export class ComboboxInput {
203277export class ComboboxPopupContainer { }
204278
205279/**
280+ * Identifies an element as a popup for an `ngCombobox`.
281+ *
282+ * This directive acts as a bridge, allowing the `ngCombobox` to discover and interact
283+ * with the underlying control (e.g., `ngListbox`, `ngTree`, or `ngComboboxDialog`) that
284+ * manages the options. It's primarily used as a host directive and is responsible for
285+ * exposing the popup's control pattern to the parent combobox.
286+ *
206287 * @developerPreview 21.0
207288 */
208289@Directive ( {
@@ -213,7 +294,7 @@ export class ComboboxPopup<V> {
213294 /** The combobox that the popup belongs to. */
214295 readonly combobox = inject < Combobox < V > > ( Combobox , { optional : true } ) ;
215296
216- /** The controls the popup exposes to the combobox. */
297+ /** The popup controls exposed to the combobox. */
217298 readonly controls = signal <
218299 | ComboboxListboxControls < any , V >
219300 | ComboboxTreeControls < any , V >
@@ -223,6 +304,18 @@ export class ComboboxPopup<V> {
223304}
224305
225306/**
307+ * Integrates a native `<dialog>` element with the combobox, allowing for
308+ * a modal or non-modal popup experience. It handles the opening and closing of the dialog
309+ * based on the combobox's expanded state.
310+ *
311+ * ```html
312+ * <ng-template ngComboboxPopupContainer>
313+ * <dialog ngComboboxDialog class="example-dialog">
314+ * <!-- ... dialog content ... -->
315+ * </dialog>
316+ * </ng-template>
317+ * ```
318+ *
226319 * @developerPreview 21.0
227320 */
228321@Directive ( {
0 commit comments