-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
155 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -255,6 +255,7 @@ export const ComboboxComponent = () => { | |
}; | ||
``` | ||
|
||
|
||
## onChangeInput | ||
|
||
`onChangeInput` is fired whenever the value of input changes whether due to typing directly in the input or from selection from menu. | ||
|
@@ -390,3 +391,22 @@ export const ComboboxCustomFilterExample = () => { | |
); | ||
}; | ||
``` | ||
|
||
export const ComboboxFetchData = () => { | ||
const [emails, setEmails] = useState([]); | ||
useEffect(() => { | ||
fetch(`https://jsonplaceholder.typicode.com/comments?postId=1`) | ||
.then((response) => response.json()) | ||
.then((json) => { | ||
const emails = json.map(j => j.email) | ||
setEmails(emails) | ||
}); | ||
}, []) | ||
return <Combobox menuList={emails} filterMethod="includes" initialValue="[email protected]"/>; | ||
} | ||
|
||
## Demo with data fetching | ||
|
||
<Canvas> | ||
<Story name="Demo with data fetching" height='500px'>{ComboboxFetchData.bind({})}</Story> | ||
</Canvas> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters