component

Combobox

props · 35 shown · 35 total

State

  • defaultValue svelte
    ComboboxValue

    Initial selection (uncontrolled). Single: a key or `null`; multiple: keys.

  • disabledKeys svelte
    Iterable<Key>

    Keys that cannot be selected or focused.

  • inputValue svelte
    string

    Bindable query text (what the user typed — distinct from the selection).

  • boolean
    default false

    Show the loading row instead of options (for async fetches).

  • open svelte
    boolean

    Bindable open state.

  • InputTone

    Semantic tone of the field, typically its validation state.

  • value svelte
    ComboboxValue

    Bindable current selection. Single: a key or `null`; multiple: an array of keys.

Appearance

  • "transparent" "surface.peak" "surface.hill" "surface.base" "surface.valley" "surface.ground"
    default "surface.peak"

    Surface ramp step the popup list paints.

  • "none" "default" "bold" "muted" "accent"
    default "muted"

    Resting border color of the popup list surface.

  • "sm" "md" "lg" "2xl" "xl" "inherit" "inner" "xs" "none" "2xs" "3xl" "4xl" "5xl" "6xl" "full"
    default "md"

    Corner radius of the popup list surface. The list is a Panel nested inside a transparent, unpadded popover `<dialog>`, so its own `radius="inner"` would resolve against that dialog's `xl` corner rather than the field — pass the corner you want explicitly.

  • "sm" "md" "lg" "xl" "xs" "none"

    Elevation of the popup list surface. Floating popups get `lg` from the listbox recipe's `[data-popover]` rule by default.

  • string

    Placeholder text for the input.

  • "sm" "md" "lg"
    default "md"

    Field and option size.

Layout

  • number

    Truncate inline chip labels to this many characters (appending `…`). The full label is kept in the chip's `title` and shown un-truncated inside the overflow popover. Composes with `chipMaxWidth`.

  • string

    CSS `max-width` (e.g. `"8rem"`) applied to inline chip labels with ellipsis truncation. Composes with `chipMaxChars`.

  • number false "auto"
    default 1

    Cap the inline chip footprint in multiselect. A `number` shows the last N selected chips inline and collapses the rest behind a "+N" overflow chip; `"auto"` measures the field and fits as many chips as the width allows; `false` disables collapsing entirely so every chip renders inline (the field grows). The framework wrappers default this to `1`; pass `false` to opt out. The "+N" chip opens a popover listing all collapsed options with remove buttons.

  • "top" "right" "bottom" "left" "top-start" "top-end" "right-start" "right-end" "bottom-start" "bottom-end" "left-start" "left-end"
    default "bottom-start"

    Floating-UI placement of the popup.

Behavior

  • boolean
    default false

    Show a "Create …" row for a typed value that isn't in the list. In multiple mode a created value is selected right away (one `onValueChange`); `onCreate` tells you to add it to `items`.

  • "remove" "edit"
    default "remove"

    What Backspace in an empty field does to the last chip: `"remove"` drops it, `"edit"` removes it and puts its text back in the field to fix.

  • string[]

    Characters that split the text into separate values (multiple + `allowCreate`). Typing one commits the text before it; pasting text that contains them adds one value per piece — a piece naming an existing option selects it, anything else is created. E.g. `[",", ";", "\n"]`.

  • boolean (optionText: string, query: string) => boolean
    default true

    `true` uses the built-in case-insensitive substring filter; `false` disables it (feed your own `items`); or pass a `(optionText, query) => boolean` predicate.

  • items required
    ListBoxNodeInput[]

    The options to choose from, in render order. An option is `{ id, label, description?, eyebrow?, leading?, trailing?, textValue?, disabled? }`; a section is `{ id, type: "section", title?, items }`. For async/remote, feed your own pre-filtered list and set `filter={false}`.

  • onCreate svelte
    (value: string) => void

    Fires for each free-text value committed (`allowCreate`). Multiple mode has already selected it — add it to `items`; single mode leaves it in the field for you to add and select.

  • (value: string) => void

    Fires when the query text changes (use with `filter={false}` for async).

  • onOpenChange svelte
    (open: boolean) => void

    Fires when the open state changes.

  • (value: ComboboxValue) => void

    Fires when the selection changes.

  • ComboboxParseCreate

    Turns typed or pasted text into the value to create (`allowCreate`): normalize it, pull an address out of `Name <a@b.c>`, …. Return `null` to reject the text — nothing is created and it stays in the field. Without it the trimmed text is created as-is.

  • "single" "multiple"
    default "single"

    `"single"` commits a label and closes; `"multiple"` toggles removable chips and keeps the popup open.

  • ComboboxChipValidator

    Checks each selected value (multiple). Return `false` or an error message to mark that chip invalid: it turns danger, and the message becomes its tooltip and part of its remove button's label.

Slots

  • empty slot svelte
    Snippet

    Content shown when there are no matches.

  • leading slot svelte
    Snippet

    Leading content inside the field (e.g. a search icon).

  • loading slot svelte
    Snippet

    Content shown while `isLoading`.

Advanced

  • element binding svelte
    HTMLInputElement null

    Bindable reference to the inner `<input>`.

  • id svelte
    string

    Stable id prefix; sub-element ids derive from it.

  • ComboboxPassThrough

    Per-slot style / attribute override bag for customizing any rendered slot or composed child component.

Plus all standard <input> HTML attributes.

Type

  • Components
  • Blocks