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: README.md
+37-21Lines changed: 37 additions & 21 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -11,16 +11,15 @@ This UI Library provides React components that manage fetching and rendering log
11
11
12
12

13
13
14
-
## How to use this UI Library
15
-
## Install
14
+
## Installation
16
15
17
16
```bash
18
17
npm i @constructor-io/constructorio-ui-autocomplete
19
18
```
20
19
21
-
There are two main methods for consuming this UI Library in a React project:
20
+
## Usage
22
21
23
-
### Component based
22
+
### Using the React Component
24
23
25
24
The `CioAutocomplete` component handles state management, data fetching, and rendering logic.
26
25
@@ -35,23 +34,24 @@ function YourComponent() {
35
34
);
36
35
```
37
36
38
-
### Hook based
37
+
### Using React Hooks
39
38
40
39
The `useCioAutocomplete` hook leaves rendering logic up to you, while handling:
41
-
- state management
42
-
- data fetching
43
-
- keyboard navigation
44
-
- mouse interactions
45
-
- focus and submit event handling
40
+
41
+
- state management
42
+
- data fetching
43
+
- keyboard navigation
44
+
- mouse interactions
45
+
- focus and submit event handling
46
46
47
47
An `apiKey` or `cioJsClient` must be passed to the `useCioAutocomplete` hook along with an `onSubmit` callback function. All other values are optional.
This is a framework agnostic method that can be used in any JavaScript project. The `CioAutocomplete` function provides a simple interface to inject an entire Autocomplete UI into the provided `selector`.
121
+
In addition to [Autocomplete component props](https://constructor-io.github.io/constructorio-ui-autocomplete/?path=/docs/autocomplete-component--docs), this function also accepts `selector` and `includeCSS`.
0 commit comments