Skip to content

shadcn.io is an independent project built on shadcn/ui

Free

Color-Coded Items Combobox for Solid

An issue-label combobox with a colored dot beside Bug, Feature, Improvement, Documentation, and Question.

UI library: Ark UI

Each label has its own dot: Bug, Feature, Improvement, Documentation, and Question. The dot sits before the name in the list and on the button after a pick.

Use it for labels and tags people already know by color. A name with no color key is a plain Combobox row. In Solid, Ark UI does not paint the dot. The row does.

Preview

Preview width

Installation

MCP · Pro
Make your AI a shadcn expert
Your agent installs components, builds pages and restyles your app from one prompt, in Claude Code, Cursor or VS Code.
Part of Pro

Anatomy

Combobox anatomy: control, input, trigger, content, item, item indicator

Usage

<Combobox collection={_listCollection.collection()} onInputValueChange={handleInputValueChange} onValueChange={handleValueChange} positioning={{
    getAnchorElement: () => triggerRef
  }} selectionBehavior="clear" value={value()}>
      <ComboboxTrigger class={cn(buttonVariants({
      variant: "outline"
    }), "w-[250px] justify-between")} ref={triggerRef}>
        {selected() ? <span class="flex items-center gap-2">
            <span aria-hidden="true" class={cn("size-3 rounded-full", selected()!.color)} />
            {selected()!.label}
          </span> : "Select label..."}
      </ComboboxTrigger>
      <ComboboxContent>
        <ComboboxInput class="w-full" placeholder="Search labels..." showTrigger={false} />
        <ComboboxEmpty>No label found.</ComboboxEmpty>
        <ComboboxList>
          {_listCollection.collection().items.map(label => <ComboboxItem class="gap-2" item={label}>
              <span aria-hidden="true" class={cn("size-3 shrink-0 rounded-full", label.color)} />
              {label.label}
            </ComboboxItem>)}
        </ComboboxList>
      </ComboboxContent>
    </Combobox>

FAQ

How is the dot drawn?

A span with size-3 rounded-full and the label's background class. It's aria-hidden, since the name next to it says the same thing.

Which colors does it use?

Theme colors, so they follow light and dark mode: bg-destructive for Bug, bg-info for Feature, bg-success for Improvement, bg-primary for Documentation and bg-warning for Question.

How does the button show the dot?

It renders the picked label's dot and name side by side, and Select label... before a pick. The demo finds the label for the current value.

Is color the only cue?

No. Every dot has its name beside it, so the labels can be told apart without seeing color.

Can I add my own colors?

Yes. Store any background class with the label, or set the dot's color inline from a hex value saved with the label.

API Reference

Combobox

Sets collection={_listCollection.collection()}, onInputValueChange={handleInputValueChange}, onValueChange={handleValueChange}, positioning, getAnchorElement and cn. The rest is on the Combobox page.