Ariakit
/

ComboboxCancel

Reseting the value of a Combobox with a button rendered next to it using the ComboboxCancel component.

import * as Ariakit from "@ariakit/react";
import "./style.css";
const list = [
"Apple",
"Bacon",
"Banana",
"Broccoli",
"Burger",
"Cake",
"Candy",
];
export default function Example() {
return (
<Ariakit.ComboboxLabel className="label">
Your favorite food
<div className="combobox-wrapper">
placeholder="e.g., Apple"
className="combobox"
/>
<Ariakit.ComboboxCancel className="button secondary combobox-cancel" />
</div>
<Ariakit.ComboboxPopover gutter={4} sameWidth className="popover">
{list.map((value) => (
key={value}
value={value}
className="combobox-item"
/>
))}
);
}

Stay tuned

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

No spam. Unsubscribe anytime. Read latest issue