Skip to content
API reference

components/combobox

Import
import * as api from "@fungi.computer/caps/components/combobox";
Kind Export Description
type alias ComboboxItemState Intrinsic focus and selection state supplied when rendering a Combobox item.
type alias ComboboxProps Props accepted by Combobox.
type alias ComboboxBaseProps Props shared by every Combobox mode: item shape, rendering, and field wiring.
type alias ComboboxInlineProps Combobox mode flags for the inline (always-expanded, no popup trigger) layout.
type alias ComboboxPopupProps Combobox mode flags for the popup layout, either caller-controlled or uncontrolled open state.
type alias ComboboxValueProps Combobox selection shape: single or multiple, controlled or uncontrolled.
constant ComboboxTrigger The same molded field face as Select, for caller-owned selection summaries.
function Combobox() A searchable selection primitive with caller-owned values and intrinsic keyboard navigation.

ComboboxItemStatetype alias

Section titled “ComboboxItemState”
Signature
type ComboboxItemState = object;

Intrinsic focus and selection state supplied when rendering a Combobox item.

Signature
active: boolean;
Signature
disabled: boolean;
Signature
selected: boolean;

ComboboxPropstype alias

Section titled “ComboboxProps”
Signature
type ComboboxProps<T> = ComboboxBaseProps<T> &
| ComboboxInlineProps
| ComboboxPopupProps & ComboboxValueProps<T>;

Props accepted by Combobox.

Type Parameter
T

ComboboxBasePropstype alias

Section titled “ComboboxBaseProps”
Signature
type ComboboxBaseProps<T> = object &
Omit<React.HTMLAttributes<HTMLDivElement>, "defaultValue" | "value">;

Props shared by every Combobox mode: item shape, rendering, and field wiring.

Name Type Description
activeTone? "neutral" | "primary" Color intent for the locally active option.
container? BasePopover.Portal.Props["container"] Native portal destination. Use an unclipped themed container for nested themes.
contentClassName? string -
emptyMessage? ReactNode -
getKey() (item) => string Returns the stable identity used to track and compare items.
getLabel() (item) => string Returns the text shown for an item in the trigger and the list.
getSearchText()? (item) => string Returns the text matched against caller input; defaults to the item’s label.
groupBy()? (item) => string Returns the heading an item is grouped under in the list.
id? string Identifies the popup trigger or inline input for native label association.
inputProps? Omit<React.InputHTMLAttributes<HTMLInputElement>, "defaultValue" | "value"> -
inputRef? React.Ref<HTMLInputElement> -
rootRef? React.Ref<HTMLDivElement> Receives the selection control’s root div.
isDisabled()? (item) => boolean Returns whether an item is unselectable.
items readonly T[] -
placeholder? string -
renderItem()? (item, active, state) => ReactNode Renders one item’s content; defaults to its label.
Type Parameter
T

ComboboxInlinePropstype alias

Section titled “ComboboxInlineProps”
Signature
type ComboboxInlineProps = object;

Combobox mode flags for the inline (always-expanded, no popup trigger) layout.

Signature
optional defaultOpen?: never;
Signature
optional onOpenChange?: never;

Popup visibility callbacks do not apply to inline choices.

Signature
optional open?: never;
Signature
optional trigger?: never;
Signature
optional triggerRef?: never;

ComboboxPopupPropstype alias

Section titled “ComboboxPopupProps”
Signature
type ComboboxPopupProps =
| {
defaultOpen?: boolean;
onOpenChange?: (open) => void;
open?: never;
trigger: ReactElement<ButtonHTMLAttributes<HTMLButtonElement>>;
triggerRef?: React.Ref<HTMLButtonElement>;
}
| {
defaultOpen?: never;
onOpenChange?: (open) => void;
open: boolean;
trigger: ReactElement<ButtonHTMLAttributes<HTMLButtonElement>>;
triggerRef?: React.Ref<HTMLButtonElement>;
};

Combobox mode flags for the popup layout, either caller-controlled or uncontrolled open state.

Signature
{
defaultOpen?: boolean;
onOpenChange?: (open) => void;
open?: never;
trigger: ReactElement<ButtonHTMLAttributes<HTMLButtonElement>>;
triggerRef?: React.Ref<HTMLButtonElement>;
}
Name Type Description
defaultOpen? boolean -
onOpenChange()? (open) => void Called after the popup’s open state changes.
open? never -
trigger ReactElement<ButtonHTMLAttributes<HTMLButtonElement>> -
triggerRef? React.Ref<HTMLButtonElement> -

Signature
{
defaultOpen?: never;
onOpenChange?: (open) => void;
open: boolean;
trigger: ReactElement<ButtonHTMLAttributes<HTMLButtonElement>>;
triggerRef?: React.Ref<HTMLButtonElement>;
}
Name Type Description
defaultOpen? never -
onOpenChange()? (open) => void Called after the popup’s open state changes.
open boolean -
trigger ReactElement<ButtonHTMLAttributes<HTMLButtonElement>> -
triggerRef? React.Ref<HTMLButtonElement> -

ComboboxValuePropstype alias

Section titled “ComboboxValueProps”
Signature
type ComboboxValueProps<T> =
|
| {
defaultValue?: never;
value: null | string;
}
| {
defaultValue?: null | string;
value?: never;
} & object
| {
multiple: true;
value: readonly string[];
defaultValue?: never;
onValueChange?: (value, items) => void;
};

Combobox selection shape: single or multiple, controlled or uncontrolled.

Type Parameter
T

| { defaultValue?: never; value: null | string; } | { defaultValue?: null | string; value?: never; } & object


Signature
{
multiple: true;
value: readonly string[];
defaultValue?: never;
onValueChange?: (value, items) => void;
}
Name Type Description
multiple true -
value readonly string[] -
defaultValue? never -
onValueChange()? (value, items) => void Called with the newly selected keys and items.

ComboboxTriggerconstant

Section titled “ComboboxTrigger”
Signature
const ComboboxTrigger: ForwardRefExoticComponent<
ButtonHTMLAttributes<HTMLButtonElement> & RefAttributes<HTMLButtonElement>
>;

The same molded field face as Select, for caller-owned selection summaries.

Signature
function Combobox<T>(props): Element;

A searchable selection primitive with caller-owned values and intrinsic keyboard navigation.

Type Parameter
T
Parameter Type
props ComboboxProps<T>

Element