diff --git a/packages/autocomplete-js/src/autocomplete.ts b/packages/autocomplete-js/src/autocomplete.ts index 53cc416b5..c530d1a75 100644 --- a/packages/autocomplete-js/src/autocomplete.ts +++ b/packages/autocomplete-js/src/autocomplete.ts @@ -39,12 +39,34 @@ type GetSources = ( export interface AutocompleteOptions extends PublicAutocompleteCoreOptions { + /** + * The container for the autocomplete search box. + * + * You can either pass a [CSS selector](https://developer.mozilla.org/docs/Web/CSS/CSS_Selectors) or an [Element](https://developer.mozilla.org/docs/Web/API/HTMLElement). The first element matching the provided selector will be used as container. + */ container: string | HTMLElement; getSources: GetSources; /** + * The dropdown horizontal position. + * * @default "input-wrapper-width" */ dropdownPlacement?: 'start' | 'end' | 'full-width' | 'input-wrapper-width'; + /** + * Function called to render the autocomplete results. It is useful for rendering sections in different row or column layouts. + * The default implementation appends all the sections to the root: + * + * ```js + * autocomplete({ + * // ... + * render({ root, sections }) { + * for (const section of sections) { + * root.appendChild(section); + * } + * }, + * }); + * ``` + */ render?(params: { root: HTMLElement; sections: HTMLElement[];