You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: packages/website/docs/createAutocomplete.md
+35-11Lines changed: 35 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,12 +2,42 @@
2
2
id: createAutocomplete
3
3
---
4
4
5
-
This function returns the methods to create an autocomplete experience.
5
+
Autocomplete Core exposes primitives to build an autocomplete experience.
6
6
7
-
You're in charge of [creating your own autocomplete renderer](creating-a-renderer) with the returned API.
7
+
The `createAutocomplete` function returns methods to help you create an autocomplete experience from scratch. This is fully headless: you're in charge of [creating your own autocomplete renderer](creating-a-renderer).
8
+
9
+
:::info
10
+
11
+
Building a custom renderer is an advanced pattern. You likely don't need it unless you've reached limitations with [`autocomplete-js`](autocomplete-js) and its templating capabilities.
This example uses the package along with the [`algoliasearch`](https://www.npmjs.com/package/algoliasearch) API client and [`getAlgoliaHits`](getAlgoliaHits) function from the Autocomplete Algolia preset. It returns [a set of functions](#returns) to build an autocomplete experience.
import CreateAutocompleteProps from './partials/createAutocomplete-props.md'
56
80
57
81
<CreateAutocompleteProps />
58
82
59
83
## Returns
60
84
85
+
The `createAutocomplete` function returns [prop getters](prop-getters), [state setters](state#setters), and a `refresh` method that updates the UI state.
86
+
61
87
```js
62
88
const {
63
89
getEnvironmentProps,
@@ -76,5 +102,3 @@ const {
76
102
refresh,
77
103
} =createAutocomplete(options);
78
104
```
79
-
80
-
This function returns the [prop getters](prop-getters), the [state setters](state#setters) and the `refresh` method that updates the UI state.
0 commit comments