MenuChevron Down
Combobox - Docs - Artefact

Combobox

Forms
Smart auto-detect

Introduction

A widget that combines a text input with a listbox, allowing users to filter and select from a list of options.

Hydration

Tier 2 — smart auto-detect. A Combobox renders as static HTML and ships no client JS unless a behavioral signal is present. Pass interactive={true} to force hydration, or interactive={false} to force a static render.

It hydrates as an island when any of the following signals is present (or interactive={true} is set):

  • open (controlled open state)
  • inputValue (controlled input value)
  • onToggle
  • onInputChange
  • onItemSelect (item selection callback — select-only comboboxes hydrate on this)
interactive propResult
omitted, no signalStatic — no client JS
omitted, a signal presentHydrates as an island
trueHydrates as an island
falseStatic — no client JS

All interactivity decisions in the library route through the shared shouldHydrate() helper in app/components/ui/island-utils.ts.

Usage

import { Combobox } from "../components/ui";

const items = [
  { label: "React", value: "react" },
  { label: "Solid", value: "solid" },
  { label: "Svelte", value: "svelte" },
  { label: "Vue", value: "vue" },
  { label: "Hono", value: "hono" },
];

export default function MyPage() {
  return (
    <Combobox
      interactive
      items={items}
      label="Framework"
      placeholder="Select a Framework"
      allowClear
    />
  );
}

CMS Page Builder

This component is available as a combobox block in the Page Builder (content/pages/*.json):

{
  "type": "combobox",
  "label": "Framework",
  "placeholder": "Select a Framework",
  "items": [
    { "label": "React", "value": "react" },
    { "label": "Hono", "value": "hono" }
  ]
}

Props

PropTypeDescription
itemsComboboxItem[]An array of items to display in the list.
labelChildThe label for the combobox.
placeholderstringThe placeholder text for the input.
allowClearbooleanWhether to show a clear button in the input.
interactivebooleanForces hydration as an island.
openbooleanWhether the combobox list is open (controlled).
inputValuestringThe current value of the input (controlled).
onToggle() => voidCallback triggered when the list is toggled.
onInputChange(value: string) => voidCallback triggered when the input value changes.
onItemSelect(value: string) => voidCallback triggered when an item is selected.

ComboboxItem

PropTypeDescription
labelstringThe display text for the item.
valuestringThe unique value for the item.
disabledbooleanWhether the item is disabled.