Ariakit
/

ComboboxItemValue

Renders a value element inside a ComboboxItem. The value will be split into span elements. The portions of the value that correspond to the combobox value will have a data-user-value attribute. The other portions will have a data-autocomplete-value attribute.

Code examples

<Combobox />
<ComboboxItem value="Apple">
// The Apple item will have a value element that looks like this:
<span>
<span data-autocomplete-value>A</span>
<span data-user-value>p</span>
<span data-user-value>p</span>
<span data-autocomplete-value>le</span>
</span>

Optional Props


render

RenderProp<React.HTMLAttributes<any> & { ref?: React.Ref<any> | undefined; }> | React.ReactElement<any, string | React.JSXElementConstructor<any>> | undefined

Allows the component to be rendered as a different HTML element or React component. The value can be a React element or a function that takes in the original component props and gives back a React element with the props merged.

Check out the Composition guide for more details.


store

ComboboxStore<ComboboxStoreSelectedValue> | undefined

Object returned by the useComboboxStore hook. If not provided, the closest ComboboxList or ComboboxPopover components' context will be used.


value

string | undefined

The current combobox item value. If not provided, the parent ComboboxItem component's value prop will be used.

Stay tuned

Join 1,000+ subscribers and receive monthly tips & updates on new Ariakit content.

No spam. Unsubscribe anytime. Read latest issue