shadcn.io is an independent project built on shadcn/ui
Red and Blue start selected, and the button reads 2 color(s) selected. An X next to the chevron clears every color at once, instead of unpicking them one by one.
Use it for filters and other multi-selects people often reset. Removing one chip at a time fits a Combobox with chips. In Solid, Ark UI does not add the clear-all button.
Installation
Anatomy

Usage
<div class="relative w-[250px]">
<Combobox collection={_listCollection.collection()} multiple onInputValueChange={handleInputValueChange} onValueChange={handleValueChange} positioning={{
getAnchorElement: () => triggerRef
}} value={value()}>
<ComboboxTrigger class={cn(buttonVariants({
variant: "outline"
}), "w-full justify-between pe-3")} ref={triggerRef}>
{value().length > 0 ? `${value().length} color(s) selected` : "Select colors..."}
</ComboboxTrigger>
<ComboboxContent>
<ComboboxInput class="w-full" placeholder="Search colors..." showTrigger={false} />
<ComboboxEmpty>No color found.</ComboboxEmpty>
<ComboboxList>
{_listCollection.collection().items.map(color => <ComboboxItem item={color}>
{color.label}
</ComboboxItem>)}
</ComboboxList>
</ComboboxContent>
</Combobox>
{value().length > 0 ? <Button aria-label="Clear colors" class="absolute end-8 top-1/2 -translate-y-1/2" onClick={handleClear} pill size="icon-xs" variant="ghost">
<XIcon aria-hidden="true" />
</Button> : null}
</div>FAQ
Where does the clear button sit?
In a relative wrapper around the combobox, positioned absolute end-8 so it lands just before the chevron. It's a sibling of the trigger, not inside it, since a button can't contain another button.
What does it clear?
The whole selection: the demo sets the value to an empty array, and the button goes back to Select colors....
How is the button styled?
A ghost, pill, icon-xs Button with an XIcon. It has aria-label Clear colors, since the icon has no text.
API Reference
Combobox
Sets collection={_listCollection.collection()}, multiple, onInputValueChange={handleInputValueChange}, onValueChange={handleValueChange}, positioning and getAnchorElement. The rest is on the Combobox page.
Button
Sets aria-label="Clear colors", onClick={handleClear}, pill, size="icon-xs" and variant="ghost". The rest is on the Button page.





