Docs Components Forms

Combobox

React example follows below.
ts
const comboboxFixture = {
id: "combobox",
label: "Service",
defaultValue: ["ledger-api"],
options: [
{ value: "ledger-api", label: "ledger-api" },
{ value: "ledger-worker", label: "ledger-worker" },
{ value: "billing-api", label: "billing-api", disabled: true },
],
} as const;
import { Combobox } from "@grassroot/ui-react";
export default function ComboboxDemo() {
return (
<div>
<Combobox
id={comboboxFixture.id}
label={comboboxFixture.label}
defaultValue={comboboxFixture.defaultValue}
options={[...comboboxFixture.options]}
/>
</div>
);
}
ts
<script setup lang="ts">
import { ref } from "vue";
const comboboxFixture = {
id: "combobox",
label: "Service",
defaultValue: ["ledger-api"],
options: [
{ value: "ledger-api", label: "ledger-api" },
{ value: "ledger-worker", label: "ledger-worker" },
{ value: "billing-api", label: "billing-api", disabled: true },
],
} as const;
import { Combobox } from "@grassroot/ui-vue";
const value = ref(comboboxFixture.defaultValue);
</script>
<template>
<div>
<Combobox
v-model="value"
:label="comboboxFixture.label"
:options="[...comboboxFixture.options]"
/>
</div>
</template>
ts
import { Component } from "@angular/core";
const comboboxFixture = {
id: "combobox",
label: "Service",
defaultValue: ["ledger-api"],
options: [
{ value: "ledger-api", label: "ledger-api" },
{ value: "ledger-worker", label: "ledger-worker" },
{ value: "billing-api", label: "billing-api", disabled: true },
],
} as const;
import { GrassrootCombobox } from "@grassroot/ui-angular";
@Component({
selector: "app-combobox-demo",
standalone: true,
imports: [GrassrootCombobox],
template: `<div>
<grassroot-combobox
[label]="fixture.label"
[options]="fixture.options"
[value]="fixture.defaultValue"
/>
</div>`,
})
export class ComboboxDemoComponent {
protected readonly fixture = comboboxFixture;
}
export default ComboboxDemoComponent;
ts
<script lang="ts">
const comboboxFixture = {
id: "combobox",
label: "Service",
defaultValue: ["ledger-api"],
options: [
{ value: "ledger-api", label: "ledger-api" },
{ value: "ledger-worker", label: "ledger-worker" },
{ value: "billing-api", label: "billing-api", disabled: true },
],
} as const;
import { Combobox } from "@grassroot/ui-svelte";
</script>
<div>
<Combobox
label={comboboxFixture.label}
options={[...comboboxFixture.options]}
defaultValue={comboboxFixture.defaultValue}
/>
</div>
ts
/** @jsxImportSource solid-js */
const comboboxFixture = {
id: "combobox",
label: "Service",
defaultValue: ["ledger-api"],
options: [
{ value: "ledger-api", label: "ledger-api" },
{ value: "ledger-worker", label: "ledger-worker" },
{ value: "billing-api", label: "billing-api", disabled: true },
],
} as const;
import { Combobox } from "@grassroot/ui-solid";
export default function ComboboxDemo() {
return (
<div>
<Combobox
label={comboboxFixture.label}
options={[...comboboxFixture.options]}
defaultValue={comboboxFixture.defaultValue}
/>
</div>
);
}

Installation

API Reference

Import

import { Combobox } from "@grassroot/ui-react";

Props

Prop
Type
Default
Requirement
Description
options
readonly ComboboxOption[]
—
required
—
value
ComboboxValue | undefined
—
optional
—
defaultValue
ComboboxValue | undefined
—
optional
—
selectionMode
"single" | "multiple" | undefined
—
optional
—
onValueChange
((value: ComboboxValue) => void) | undefined
—
optional
—
open
boolean | undefined
—
optional
—
onOpenChange
((open: boolean) => void) | undefined
—
optional
—
inputValue
string | undefined
—
optional
—
defaultInputValue
string | undefined
—
optional
—
onInputValueChange
((inputValue: string) => void) | undefined
—
optional
—
loadOptions
boolean | undefined
—
optional
—
runCommand
import("@grassroot/ui-headless-core/combobox").ComboboxRunCommand | undefined
—
optional
—
name
string | undefined
—
optional
—
required
boolean | undefined
—
optional
—
Prop
options
Type
readonly ComboboxOption[]
Default
—
Requirement
required
Description
—
Prop
value
Type
ComboboxValue | undefined
Default
—
Requirement
optional
Description
—
Prop
defaultValue
Type
ComboboxValue | undefined
Default
—
Requirement
optional
Description
—
Prop
selectionMode
Type
"single" | "multiple" | undefined
Default
—
Requirement
optional
Description
—
Prop
onValueChange
Type
((value: ComboboxValue) => void) | undefined
Default
—
Requirement
optional
Description
—
Prop
open
Type
boolean | undefined
Default
—
Requirement
optional
Description
—
Prop
onOpenChange
Type
((open: boolean) => void) | undefined
Default
—
Requirement
optional
Description
—
Prop
inputValue
Type
string | undefined
Default
—
Requirement
optional
Description
—
Prop
defaultInputValue
Type
string | undefined
Default
—
Requirement
optional
Description
—
Prop
onInputValueChange
Type
((inputValue: string) => void) | undefined
Default
—
Requirement
optional
Description
—
Prop
loadOptions
Type
boolean | undefined
Default
—
Requirement
optional
Description
—
Prop
runCommand
Type
import("@grassroot/ui-headless-core/combobox").ComboboxRunCommand | undefined
Default
—
Requirement
optional
Description
—
Prop
name
Type
string | undefined
Default
—
Requirement
optional
Description
—
Prop
required
Type
boolean | undefined
Default
—
Requirement
optional
Description
—
Prop
label
Type
string | undefined
Default
—
Requirement
optional
Description
—
Prop
"aria-label"
Type
string | undefined
Default
—
Requirement
optional
Description
Accessible name for trigger when no visible label is rendered.
Prop
"aria-labelledby"
Type
string | undefined
Default
—
Requirement
optional
Description
ID of external element labelling the trigger.
Prop
dir
Type
"ltr" | "rtl" | undefined
Default
—
Requirement
optional
Description
Text direction.
Prop
placeholder
Type
string | undefined
Default
—
Requirement
optional
Description
—
Prop
searchPlaceholder
Type
string | undefined
Default
"Search…"
Requirement
optional
Description
Placeholder inside filter input.
Prop
emptyText
Type
string | undefined
Default
"No results"
Requirement
optional
Description
Shown when filter matches nothing.
Prop
defaultOpen
Type
boolean | undefined
Default
false
Requirement
optional
Description
Render initially open — handy for layout/stories.
Prop
className
Type
string | undefined
Default
—
Requirement
optional
Description
—
Prop
id
Type
string | undefined
Default
—
Requirement
optional
Description
—

Events

EventPayload
onValueChange((value: ComboboxValue) => void) | undefined
onOpenChange((open: boolean) => void) | undefined
onInputValueChange((inputValue: string) => void) | undefined

Import

import { ref } from "vue";
import { Combobox } from "@grassroot/ui-vue";

Props

Prop
Type
Default
Requirement
options
readonly ComboboxOptionInput[]
—
required
modelValue
ComboboxValue | undefined
—
optional
defaultValue
ComboboxValue | undefined
—
optional
selectionMode
"single" | "multiple" | undefined
—
optional
open
boolean | undefined
undefined
optional
inputValue
string | undefined
—
optional
defaultInputValue
string | undefined
—
optional
loadOptions
boolean | undefined
—
optional
runCommand
ComboboxRunCommand | undefined
—
optional
name
string | undefined
—
optional
required
boolean | undefined
—
optional
label
string | undefined
—
optional
placeholder
string | undefined
"Select…"
optional
searchPlaceholder
string | undefined
"Search…"
optional
Prop
options
Type
readonly ComboboxOptionInput[]
Default
—
Requirement
required
Prop
modelValue
Type
ComboboxValue | undefined
Default
—
Requirement
optional
Prop
defaultValue
Type
ComboboxValue | undefined
Default
—
Requirement
optional
Prop
selectionMode
Type
"single" | "multiple" | undefined
Default
—
Requirement
optional
Prop
open
Type
boolean | undefined
Default
undefined
Requirement
optional
Prop
inputValue
Type
string | undefined
Default
—
Requirement
optional
Prop
defaultInputValue
Type
string | undefined
Default
—
Requirement
optional
Prop
loadOptions
Type
boolean | undefined
Default
—
Requirement
optional
Prop
runCommand
Type
ComboboxRunCommand | undefined
Default
—
Requirement
optional
Prop
name
Type
string | undefined
Default
—
Requirement
optional
Prop
required
Type
boolean | undefined
Default
—
Requirement
optional
Prop
label
Type
string | undefined
Default
—
Requirement
optional
Prop
placeholder
Type
string | undefined
Default
"Select…"
Requirement
optional
Prop
searchPlaceholder
Type
string | undefined
Default
"Search…"
Requirement
optional
Prop
emptyText
Type
string | undefined
Default
"No results"
Requirement
optional
Prop
defaultOpen
Type
boolean | undefined
Default
false
Requirement
optional
Prop
id
Type
string | undefined
Default
—
Requirement
optional
Prop
dir
Type
"ltr" | "rtl" | undefined
Default
—
Requirement
optional

Events

EventPayload
update:modelValue[value: ComboboxValue]
update:open[open: boolean]
update:inputValue[value: string]

Import

import { Component } from "@angular/core";
import { GrassrootCombobox } from "@grassroot/ui-angular";

Props

Prop
Type
Default
Requirement
options
readonly ComboboxOptionInput[]
—
required
label
string
—
optional
placeholder
string
"Select…"
optional
searchPlaceholder
string
"Search…"
optional
emptyText
string
"No results"
optional
id
string
—
optional
"aria-label"
string
undefined
optional
"aria-labelledby"
string
undefined
optional
defaultOpen
boolean
false
optional
open
boolean
—
optional
selectionMode
"single" | "multiple"
—
optional
value
ComboboxValue
—
optional
defaultValue
ComboboxValue
—
optional
inputValue
string
—
optional
Prop
options
Type
readonly ComboboxOptionInput[]
Default
—
Requirement
required
Prop
label
Type
string
Default
—
Requirement
optional
Prop
placeholder
Type
string
Default
"Select…"
Requirement
optional
Prop
searchPlaceholder
Type
string
Default
"Search…"
Requirement
optional
Prop
emptyText
Type
string
Default
"No results"
Requirement
optional
Prop
id
Type
string
Default
—
Requirement
optional
Prop
"aria-label"
Type
string
Default
undefined
Requirement
optional
Prop
"aria-labelledby"
Type
string
Default
undefined
Requirement
optional
Prop
defaultOpen
Type
boolean
Default
false
Requirement
optional
Prop
open
Type
boolean
Default
—
Requirement
optional
Prop
selectionMode
Type
"single" | "multiple"
Default
—
Requirement
optional
Prop
value
Type
ComboboxValue
Default
—
Requirement
optional
Prop
defaultValue
Type
ComboboxValue
Default
—
Requirement
optional
Prop
inputValue
Type
string
Default
—
Requirement
optional
Prop
defaultInputValue
Type
string
Default
—
Requirement
optional
Prop
loadOptions
Type
boolean
Default
—
Requirement
optional
Prop
runCommand
Type
ComboboxRunCommand
Default
—
Requirement
optional
Prop
name
Type
string
Default
—
Requirement
optional
Prop
required
Type
boolean
Default
false
Requirement
optional
Prop
dir
Type
"ltr" | "rtl"
Default
—
Requirement
optional

Events

EventPayload
openChangeboolean
valueChangeComboboxValue
inputValueChangestring

Import

import { Combobox } from "@grassroot/ui-svelte";

Props

Prop
Type
Default
Requirement
options
readonly ComboboxOptionInput[]
—
required
value
ComboboxValue
—
optional
defaultValue
ComboboxValue
—
optional
selectionMode
"single" | "multiple"
—
optional
label
string
—
optional
placeholder
string
"Select…"
optional
searchPlaceholder
string
"Search…"
optional
emptyText
string
"No results"
optional
defaultOpen
boolean
false
optional
open
boolean
—
optional
inputValue
string
—
optional
defaultInputValue
string
—
optional
loadOptions
boolean
—
optional
name
string
—
optional
Prop
options
Type
readonly ComboboxOptionInput[]
Default
—
Requirement
required
Prop
value
Type
ComboboxValue
Default
—
Requirement
optional
Prop
defaultValue
Type
ComboboxValue
Default
—
Requirement
optional
Prop
selectionMode
Type
"single" | "multiple"
Default
—
Requirement
optional
Prop
label
Type
string
Default
—
Requirement
optional
Prop
placeholder
Type
string
Default
"Select…"
Requirement
optional
Prop
searchPlaceholder
Type
string
Default
"Search…"
Requirement
optional
Prop
emptyText
Type
string
Default
"No results"
Requirement
optional
Prop
defaultOpen
Type
boolean
Default
false
Requirement
optional
Prop
open
Type
boolean
Default
—
Requirement
optional
Prop
inputValue
Type
string
Default
—
Requirement
optional
Prop
defaultInputValue
Type
string
Default
—
Requirement
optional
Prop
loadOptions
Type
boolean
Default
—
Requirement
optional
Prop
name
Type
string
Default
—
Requirement
optional
Prop
required
Type
boolean
Default
—
Requirement
optional
Prop
dir
Type
"ltr" | "rtl"
Default
—
Requirement
optional
Prop
id
Type
string
Default
—
Requirement
optional
Prop
aria-label
Type
string
Default
—
Requirement
optional
Prop
aria-labelledby
Type
string
Default
—
Requirement
optional
Prop
className
Type
string
Default
—
Requirement
optional
Prop
onValueChange
Type
(value: ComboboxValue) => void
Default
—
Requirement
optional
Prop
onOpenChange
Type
(open: boolean) => void
Default
—
Requirement
optional
Prop
onInputValueChange
Type
(inputValue: string) => void
Default
—
Requirement
optional
Prop
runCommand
Type
UseComboboxOptions["runCommand"]
Default
—
Requirement
optional

Events

EventPayload
onValueChange(value: ComboboxValue) => void
onOpenChange(open: boolean) => void
onInputValueChange(inputValue: string) => void

Import

import { Combobox } from "@grassroot/ui-solid";

Props

Prop
Type
Default
Requirement
options
readonly ComboboxOptionInput[]
—
required
value
ComboboxValue
—
optional
defaultValue
ComboboxValue
—
optional
selectionMode
"single" | "multiple"
—
optional
onValueChange
(value: ComboboxValue) => void
—
optional
open
boolean
—
optional
onOpenChange
(open: boolean) => void
—
optional
inputValue
string
—
optional
defaultInputValue
string
—
optional
onInputValueChange
(inputValue: string) => void
—
optional
loadOptions
boolean
—
optional
runCommand
ComboboxRunCommand
—
optional
name
string
—
optional
required
boolean
—
optional
Prop
options
Type
readonly ComboboxOptionInput[]
Default
—
Requirement
required
Prop
value
Type
ComboboxValue
Default
—
Requirement
optional
Prop
defaultValue
Type
ComboboxValue
Default
—
Requirement
optional
Prop
selectionMode
Type
"single" | "multiple"
Default
—
Requirement
optional
Prop
onValueChange
Type
(value: ComboboxValue) => void
Default
—
Requirement
optional
Prop
open
Type
boolean
Default
—
Requirement
optional
Prop
onOpenChange
Type
(open: boolean) => void
Default
—
Requirement
optional
Prop
inputValue
Type
string
Default
—
Requirement
optional
Prop
defaultInputValue
Type
string
Default
—
Requirement
optional
Prop
onInputValueChange
Type
(inputValue: string) => void
Default
—
Requirement
optional
Prop
loadOptions
Type
boolean
Default
—
Requirement
optional
Prop
runCommand
Type
ComboboxRunCommand
Default
—
Requirement
optional
Prop
name
Type
string
Default
—
Requirement
optional
Prop
required
Type
boolean
Default
—
Requirement
optional
Prop
label
Type
string
Default
—
Requirement
optional
Prop
placeholder
Type
string
Default
"Select…"
Requirement
optional
Prop
searchPlaceholder
Type
string
Default
"Search…"
Requirement
optional
Prop
emptyText
Type
string
Default
"No results"
Requirement
optional
Prop
defaultOpen
Type
boolean
Default
—
Requirement
optional
Prop
id
Type
string
Default
—
Requirement
optional
Prop
aria-label
Type
string
Default
—
Requirement
optional
Prop
aria-labelledby
Type
string
Default
—
Requirement
optional
Prop
dir
Type
"ltr" | "rtl"
Default
—
Requirement
optional
Prop
className
Type
string
Default
—
Requirement
optional

Events

EventPayload
onValueChange(value: ComboboxValue) => void
onOpenChange(open: boolean) => void
onInputValueChange(inputValue: string) => void