Skip to content

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

Free

No Results Variation Combobox for Ark UI

A fruit combobox that shows a search icon, No results, and a hint when the typed fruit is not in the list.

Apple, Banana, Cherry, Date, and Elderberry are the list. A search that matches none of them shows a search icon, No results, and Try a different search term.

Use it when people often type something that is not there, and they need a next step. A one-line miss is the plain empty state of a Combobox. In React, Ark UI only knows the search missed.

Preview

Preview width

Installation

Sign in to get your install command
Free with an account. It carries your token, so the CLI installs everything in one go.
Use email insteadNo credit card

Anatomy

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

Usage

<Combobox
  collection={collection}
  onInputValueChange={handleInputValueChange}
  onValueChange={handleValueChange}
  positioning={{ getAnchorElement: () => triggerRef.current }}
  selectionBehavior="clear"
  value={value}
>
  <ComboboxTrigger
    className={cn(
      buttonVariants({ variant: "outline" }),
      "w-[200px] justify-between"
    )}
    ref={triggerRef}
  >
    {value[0] ?? "Select fruit..."}
  </ComboboxTrigger>
  <ComboboxContent>
    <ComboboxInput
      className="w-full"
      placeholder="Search fruits..."
      showTrigger={false}
    />
    <ComboboxEmpty>
      <div className="flex flex-col items-center gap-2 p-4 text-center">
        <SearchIcon
          aria-hidden="true"
          className="size-8 text-muted-foreground"
        />
        <div>
          <p className="font-medium text-sm">No results</p>
{/* The rest of the file is under Installation. */}

FAQ

What does the no-results block show?

A SearchIcon at size-8 in text-muted-foreground, No results in font-medium, and Try a different search term in muted text-xs, centered in a column.

When does it show?

Only when the search leaves nothing to show. It's the content of ComboboxEmpty, which renders only then.

Which fruits are listed?

Apple, Banana, Cherry, Date and Elderberry. The search box says Search fruits....

How do I pick a fruit?

Type to narrow the list, then click a fruit or move to it with the arrow keys and press Enter. The button then shows it in place of Select fruit....

Can the message offer an action?

Yes, any content fits. Add a button that clears the search or creates the missing item, as in Empty State with Action.

Is the icon announced?

No, it has aria-hidden. The two lines of text carry the message.

API Reference

Combobox

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