Skip to content
Kappa
Combobox
@dicehub/kappav0.4.2

Combobox

Filters a known collection and selects one or more values in dense technical workflows.

<script setup>
import { ref } from "vue";
import { Combobox } from "@dicehub/kappa/components/combobox";

const value = ref(["eu-central"]);
const regions = [
  { label: "EU Central · Frankfurt", value: "eu-central" },
  { label: "EU West · Dublin", value: "eu-west" },
  { label: "US East · Virginia", value: "us-east" },
];
</script>

<template>
  <Combobox
    v-model="value"
    :items="regions"
    label="Compute region"
    description="Routes the run to the selected cluster."
    input-behavior="autohighlight"
    placeholder="Select a region"
  />
</template>

Installation

Combobox is part of the main Kappa package. Ark UI owns focus, keyboard navigation, selection, form values, live option state, and floating positioning.

Barrel

import {
  Combobox,
  createComboboxCollection,
} from "@dicehub/kappa";

Granular

import {
  Combobox,
  createComboboxCollection,
} from "@dicehub/kappa/components/combobox";

Usage

Use Combobox when the submitted value must come from a known collection. It rejects custom text by default. Use Autocomplete when free-form text is valid.

<script setup>
import { ref } from "vue";
import {
  Combobox,
  createComboboxCollection,
} from "@dicehub/kappa/components/combobox";

const value = ref(["openfoam"]);
const collection = createComboboxCollection({
  items: [
    { label: "Binary mesh", value: "binary" },
    { label: "OpenFOAM mesh", value: "openfoam" },
  ],
  itemToString: (item) => item.label,
  itemToValue: (item) => item.value,
});
</script>

<template>
  <Combobox v-model="value" :collection="collection" label="Mesh format">
    <Combobox.TriggerInput placeholder="Select a format" />
    <Combobox.Content>
      <Combobox.Empty>No matching format.</Combobox.Empty>
      <Combobox.List>
        <template #default="{ item }">
          <Combobox.Item :item="item">{{ item.label }}</Combobox.Item>
        </template>
      </Combobox.List>
    </Combobox.Content>
  </Combobox>
</template>

Composition

Typical part hierarchy
Combobox.Root
├── Combobox.Label
├── Combobox.TriggerInput / TriggerValue / TriggerMultipleWithInput
└── Combobox.Content
    ├── Combobox.Input (optional popup search)
    ├── Combobox.Empty
    └── Combobox.List
        ├── Combobox.Group
        │   ├── Combobox.GroupLabel
        │   └── Combobox.Item
        │       ├── Combobox.ItemText
        │       └── Combobox.ItemIndicator
        └── Combobox.Separator

TriggerInput is an editable control. TriggerValue is a select-like button. Add Input inside Content when a button trigger still needs search. Multiple selection uses TriggerMultipleWithInput.

Content teleports to body by default and accepts Ark positioning props such as placement, sameWidth, flip, andstrategy.

Examples

Keep the selected value quiet until the user opens a searchable popup.

<Combobox v-model="language" :collection="languages">
  <Combobox.TriggerValue placeholder="Select a language" />
  <Combobox.Content>
    <Combobox.Input aria-label="Search languages" placeholder="Search languages" />
    <Combobox.Empty>No matching language.</Combobox.Empty>
    <Combobox.List>
      <template #default="{ item }">
        <Combobox.Item :item="item">{{ item.label }}</Combobox.Item>
      </template>
    </Combobox.List>
  </Combobox.Content>
</Combobox>

Custom Trigger

Use asChild to merge Ark trigger behavior into one Kappa Button.

<script setup>
import { Button } from "@dicehub/kappa/components/button";
import { Combobox } from "@dicehub/kappa/components/combobox";
</script>

<template>
  <Combobox v-model="language" :collection="languages">
    <Combobox.Trigger as-child>
      <Button variant="outline">
        Language: <Combobox.Value />
      </Button>
    </Combobox.Trigger>
    <Combobox.Content :same-width="false">
      <Combobox.List>
        <template #default="{ item }">
          <Combobox.Item :item="item">{{ item.label }}</Combobox.Item>
        </template>
      </Combobox.List>
    </Combobox.Content>
  </Combobox>
</template>

Grouped Options

The root scoped slot exposes the filtered collection, so empty groups disappear with the query.

<script setup>
import { Combobox, createComboboxCollection } from "@dicehub/kappa/components/combobox";

const collection = createComboboxCollection({
  items: solvers,
  groupBy: (item) => item.group,
  itemToString: (item) => item.label,
  itemToValue: (item) => item.value,
});
</script>

<template>
  <Combobox v-model="solver" :collection="collection">
    <template #default="{ collection: filteredCollection }">
      <Combobox.TriggerInput placeholder="Select a solver" />
      <Combobox.Content>
        <Combobox.Empty>No matching solver.</Combobox.Empty>
        <Combobox.List :render-items="false">
          <Combobox.Group
            v-for="[group, items] in filteredCollection.group()"
            :key="group"
          >
            <Combobox.GroupLabel>{{ group }}</Combobox.GroupLabel>
            <Combobox.Item v-for="item in items" :key="item.value" :item="item">
              {{ item.label }}
            </Combobox.Item>
          </Combobox.Group>
        </Combobox.List>
      </Combobox.Content>
    </template>
  </Combobox>
</template>

Multiple Values

Selected values become removable chips. The popup stays open after each selection.

<Combobox v-model="tags" :collection="tagCollection" multiple>
  <Combobox.TriggerMultipleWithInput placeholder="Add a tag" />
  <Combobox.Content>
    <Combobox.Empty>No matching tag.</Combobox.Empty>
    <Combobox.List>
      <template #default="{ item }">
        <Combobox.Item :item="item">{{ item.label }}</Combobox.Item>
      </template>
    </Combobox.List>
  </Combobox.Content>
</Combobox>

Sizes

<Combobox size="xs" :items="regions" aria-label="Extra small region" />
<Combobox size="sm" :items="regions" aria-label="Small region" />
<Combobox size="base" :items="regions" aria-label="Base region" />
<Combobox size="lg" :items="regions" aria-label="Large region" />

Disabled and Invalid

Error text sets invalid state and joins the input's accessible description.

<Combobox
  :items="formats"
  disabled
  label="Source format"
  placeholder="Unavailable"
/>

<Combobox
  v-model="format"
  :items="formats"
  error="Select one supported output format."
  label="Output format"
  placeholder="Required"
  required
/>

Accessibility

  • Arrow Down and Arrow Up move through enabled options.
  • Enter selects the highlighted option. Escape closes the popup.
  • Home and End move to the first and last enabled options.
  • Labels, descriptions, errors, disabled state, and invalid state stay connected.
  • Selected indicators are visual support; Ark announces selection state.
  • Popup motion honors prefers-reduced-motion.

Kappa preserves the primitive contract. See theofficial Ark UI Combobox documentation.

API Reference

Combobox.Root

Forwards remaining attributes, listeners, controlled state, and Ark UI root behavior.

PropTypeDefaultDescription
itemsreadonly T[][]Items for the convenience composition.
collectionComboboxCollection<T>generatedArk list collection for mapped items, groups, and disabled state.
modelValuestring[]-Controlled selection; supports v-model.
defaultValuestring[][]Initial uncontrolled selection.
inputValuestring-Controlled text; supports v-model:input-value.
openboolean-Controlled popup state; supports v-model:open.
multiplebooleanfalseAllows more than one selected value.
allowCustomValuebooleanfalseAllows text that is not a collection item when true.
filterfalse | (item, query) => booleancontains labelLocal filter. Pass false for external filtering.
itemToString(item) => stringitem.labelMaps an item to visible and searchable text.
itemToValue(item) => stringitem.valueMaps an item to its stable value.
isItemDisabled(item) => booleanitem.disabledMarks options unavailable and removes them from keyboard selection.
showOnEmptybooleantrueShows all items before a query is entered.
closeOnSelectboolean!multipleCloses after selection for single-value use.
selectionBehavior"clear" | "replace" | "preserve"clear for multiple; replace otherwiseControls input text after selection.
size"xs" | "sm" | "base" | "lg""base"Control height and text density.
disabled / readOnly / invalid / requiredbooleanfalseField interaction and validation states.
label / description / errorstring-Connected field copy for the convenience composition.
positioningComboboxPositioningOptionsviewport-safe bottom-startArk floating position options.
lazyMount / unmountOnExitbooleanfalsePopup render strategy.

Parts

PartElementDescription
Combobox.TriggerInputinput controlEditable trigger with optional clear and toggle buttons.
Combobox.TriggerValuebuttonSelect-like trigger that displays the current value.
Combobox.TriggerMultipleWithInputinput controlChip list and filter input for multiple selection.
Combobox.ContentdivPortalled popup. It also accepts every Ark positioning option.
Combobox.InputinputArk-connected input for custom controls or popup search.
Combobox.ListdivScrollable listbox with scoped item rendering.
Combobox.ItemdivSelectable option with text and selected indicator parts.
Combobox.Group / GroupLabeldivAccessible grouped-option structure.
Combobox.ChipspanSelected value with an accessible remove button.
Combobox.Trigger / Valuebutton / spanLow-level parts for a custom select-like trigger.
Combobox.Control / ClearTriggerdiv / buttonLow-level editable-control composition.
Combobox.Empty / Separator / ContextvariousEmpty, visual grouping, and reactive state helpers.

Events

EventPayloadDescription
update:modelValuestring[]Updates v-model after selection changes.
valueChangeComboboxValueChangeDetails<T>Provides selected values and items.
update:inputValuestringUpdates v-model:input-value after text changes.
inputValueChangeComboboxInputValueChangeDetailsProvides text and the Ark change reason.
update:openbooleanUpdates v-model:open.
openChangeComboboxOpenChangeDetailsProvides the new popup state and reason.
highlightChange / selectArk detailsReports active-option and selection interactions.

Exports

ExportDescription
ComboboxCompound component with every Kappa part attached.
ComboboxRootUnaugmented root component.
Combobox* partsNamed exports for all controls, triggers, popup, list, item, group, chip, and context parts.
createComboboxCollectionKappa alias for Ark createListCollection.
useComboboxCollectionReactive collection helper.
useCombobox / useComboboxContext / useComboboxItemContextArk state and context hooks.
comboboxAnatomyArk part anatomy metadata.
COMBOBOX_SIZESReadonly list of supported sizes.
Combobox* typesRoot, part, event, collection, filter, item, and positioning contracts.