Skip to content

Commit

Permalink
docs: typeahead prop doc (#17812)
Browse files Browse the repository at this point in the history
  • Loading branch information
2nikhiltom authored Oct 21, 2024
1 parent f2c4993 commit 6d2da4d
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
6 changes: 6 additions & 0 deletions packages/react/src/components/ComboBox/ComboBox.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,12 @@ changes.
For more information, checkout the Downshift `useCombobox` props
[documentation](https://github.com/downshift-js/downshift/tree/v9.0.7/src/hooks/useCombobox#basic-props)

## typeahead Prop

The `typeahead` prop enables predictive text and autocomplete functionality in the ComboBox. When enabled, it displays inline suggestions as you type, using a built-in prefix-matching filter that ignores the `shouldFilterItem` prop. Pressing `Tab` will complete the input with the first matching suggestion, while arrow keys can still be used to navigate through filtered options.

When combined with the `allowCustomValue` prop, the ComboBox supports both custom values and typeahead suggestions.

### Combobox `downshiftActions`

The downshift action methods are made available through the `downshiftActions`
Expand Down
10 changes: 9 additions & 1 deletion packages/react/src/components/ComboBox/ComboBox.stories.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,15 @@ export const AutocompleteWithTypeahead = (args) => {
onChange={args.onChange}
helperText="Combobox helper text"
id="carbon-combobox"
items={['Apple', 'Orange', 'Banana', 'Pineapple', 'Raspberry', 'Lime']}
items={[
'Apple',
'Apricot',
'Avocado',
'Banana',
'Blackberry',
'Blueberry',
'Cantaloupe',
]}
titleText="ComboBox title"
typeahead
/>
Expand Down

0 comments on commit 6d2da4d

Please sign in to comment.