components/combobox
Import
Section titled “Import”import * as api from "@fungi.computer/caps/components/combobox";Exports
Section titled “Exports”| 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”type ComboboxItemState = object;Intrinsic focus and selection state supplied when rendering a Combobox item.
Properties
Section titled “Properties”active
Section titled “active”active: boolean;disabled
Section titled “disabled”disabled: boolean;selected
Section titled “selected”selected: boolean;ComboboxPropstype alias
Section titled “ComboboxProps”type ComboboxProps<T> = ComboboxBaseProps<T> & | ComboboxInlineProps| ComboboxPopupProps & ComboboxValueProps<T>;Props accepted by Combobox.
Type Parameters
Section titled “Type Parameters”| Type Parameter |
|---|
T |
ComboboxBasePropstype alias
Section titled “ComboboxBaseProps”type ComboboxBaseProps<T> = object & Omit<React.HTMLAttributes<HTMLDivElement>, "defaultValue" | "value">;Props shared by every Combobox mode: item shape, rendering, and field wiring.
Type Declaration
Section titled “Type Declaration”| 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 Parameters
Section titled “Type Parameters”| Type Parameter |
|---|
T |
ComboboxInlinePropstype alias
Section titled “ComboboxInlineProps”type ComboboxInlineProps = object;Combobox mode flags for the inline (always-expanded, no popup trigger) layout.
Properties
Section titled “Properties”defaultOpen?
Section titled “defaultOpen?”optional defaultOpen?: never;onOpenChange?
Section titled “onOpenChange?”optional onOpenChange?: never;Popup visibility callbacks do not apply to inline choices.
optional open?: never;trigger?
Section titled “trigger?”optional trigger?: never;triggerRef?
Section titled “triggerRef?”optional triggerRef?: never;ComboboxPopupPropstype alias
Section titled “ComboboxPopupProps”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.
Union Members
Section titled “Union Members”Type Literal
Section titled “Type Literal”{ 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> |
- |
Type Literal
Section titled “Type Literal”{ 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”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 Parameters
Section titled “Type Parameters”| Type Parameter |
|---|
T |
Union Members
Section titled “Union Members”| { defaultValue?: never; value: null | string; } | {
defaultValue?: null | string; value?: never; } & object
Type Literal
Section titled “Type Literal”{ 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”const ComboboxTrigger: ForwardRefExoticComponent< ButtonHTMLAttributes<HTMLButtonElement> & RefAttributes<HTMLButtonElement>>;The same molded field face as Select, for caller-owned selection summaries.
Combobox()function
Section titled “Combobox()”function Combobox<T>(props): Element;A searchable selection primitive with caller-owned values and intrinsic keyboard navigation.
Type Parameters
Section titled “Type Parameters”| Type Parameter |
|---|
T |
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
props |
ComboboxProps<T> |
Returns
Section titled “Returns”Element