Circle V2 API Docs
    Preparing search index...

    Interface UseComboboxProps<T>

    interface UseComboboxProps<T extends CollectionItem> {
        allowCustomValue?: boolean;
        alwaysSubmitOnEnter?: boolean;
        autoFocus?: boolean;
        closeOnSelect?: boolean;
        collection: ListCollection<T>;
        composite?: boolean;
        defaultHighlightedValue?: string | null;
        defaultInputValue?: string;
        defaultOpen?: boolean;
        defaultValue?: string[];
        disabled?: boolean;
        disableLayer?: boolean;
        form?: string;
        highlightedValue?: string | null;
        id?: string;
        ids?: Partial<
            {
                clearTrigger: string;
                content: string;
                control: string;
                input: string;
                item: (id: string, index?: number) => string;
                itemGroup: (id: string | number) => string;
                itemGroupLabel: (id: string | number) => string;
                label: string;
                positioner: string;
                root: string;
                trigger: string;
            },
        >;
        inputBehavior?: "none"
        | "autohighlight"
        | "autocomplete";
        inputValue?: string;
        invalid?: boolean;
        loopFocus?: boolean;
        multiple?: boolean;
        name?: string;
        navigate?: ((details: NavigateDetails) => void) | null;
        onFocusOutside?: (event: Combobox.FocusOutsideEvent) => void;
        onHighlightChange?: (details: HighlightChangeDetails<T>) => void;
        onInputValueChange?: (details: InputValueChangeDetails) => void;
        onInteractOutside?: (event: Combobox.InteractOutsideEvent) => void;
        onOpenChange?: (details: OpenChangeDetails) => void;
        onPointerDownOutside?: (event: Combobox.PointerDownOutsideEvent) => void;
        onSelect?: (details: SelectionDetails) => void;
        onValueChange?: (details: ValueChangeDetails<T>) => void;
        open?: boolean;
        openOnChange?: boolean | ((details: InputValueChangeDetails) => boolean);
        openOnClick?: boolean;
        openOnKeyPress?: boolean;
        placeholder?: string;
        positioning?: PositioningOptions;
        readOnly?: boolean;
        required?: boolean;
        scrollToIndexFn?: (details: ScrollToIndexDetails) => void;
        selectionBehavior?: "clear" | "replace" | "preserve";
        translations?: IntlTranslations;
        value?: string[];
    }

    Type Parameters

    • T extends CollectionItem

    Hierarchy

    • Optional<Omit<combobox.Props<T>, "dir" | "getRootNode" | "collection">, "id">
      • UseComboboxProps
    Index

    Properties

    allowCustomValue?: boolean

    Whether to allow typing custom values in the input

    alwaysSubmitOnEnter?: boolean

    Whether to always submit on Enter key press, even if popup is open. Useful for single-field autocomplete forms where Enter should submit the form.

    false
    
    autoFocus?: boolean

    Whether to autofocus the input on mount

    closeOnSelect?: boolean

    Whether to close the combobox when an item is selected.

    collection: ListCollection<T>

    The collection of items

    composite?: boolean

    Whether the combobox is a composed with other composite widgets like tabs

    true
    
    defaultHighlightedValue?: string | null

    The initial highlighted value of the combobox when rendered. Use when you don't need to control the highlighted value of the combobox.

    defaultInputValue?: string

    The initial value of the combobox's input when rendered. Use when you don't need to control the value of the combobox's input.

    ""
    
    defaultOpen?: boolean

    The initial open state of the combobox when rendered. Use when you don't need to control the open state of the combobox.

    defaultValue?: string[]

    The initial value of the combobox's selected items when rendered. Use when you don't need to control the value of the combobox's selected items.

    []
    
    disabled?: boolean

    Whether the combobox is disabled

    disableLayer?: boolean

    Whether to disable registering this a dismissable layer

    form?: string

    The associate form of the combobox.

    highlightedValue?: string | null

    The controlled highlighted value of the combobox

    id?: string

    The unique identifier of the machine.

    ids?: Partial<
        {
            clearTrigger: string;
            content: string;
            control: string;
            input: string;
            item: (id: string, index?: number) => string;
            itemGroup: (id: string | number) => string;
            itemGroupLabel: (id: string | number) => string;
            label: string;
            positioner: string;
            root: string;
            trigger: string;
        },
    >

    The ids of the elements in the combobox. Useful for composition.

    inputBehavior?: "none" | "autohighlight" | "autocomplete"

    Defines the auto-completion behavior of the combobox.

    • autohighlight: The first focused item is highlighted as the user types
    • autocomplete: Navigating the listbox with the arrow keys selects the item and the input is updated
    "none"
    
    inputValue?: string

    The controlled value of the combobox's input

    invalid?: boolean

    Whether the combobox is invalid

    loopFocus?: boolean

    Whether to loop the keyboard navigation through the items

    true
    
    multiple?: boolean

    Whether to allow multiple selection.

    Good to know: When multiple is true, the selectionBehavior is automatically set to clear. It is recommended to render the selected items in a separate container.

    name?: string

    The name attribute of the combobox's input. Useful for form submission

    navigate?: ((details: NavigateDetails) => void) | null

    Function to navigate to the selected item

    onFocusOutside?: (event: Combobox.FocusOutsideEvent) => void

    Function called when the focus is moved outside the component

    onHighlightChange?: (details: HighlightChangeDetails<T>) => void

    Function called when an item is highlighted using the pointer or keyboard navigation.

    onInputValueChange?: (details: InputValueChangeDetails) => void

    Function called when the input's value changes

    onInteractOutside?: (event: Combobox.InteractOutsideEvent) => void

    Function called when an interaction happens outside the component

    onOpenChange?: (details: OpenChangeDetails) => void

    Function called when the popup is opened

    onPointerDownOutside?: (event: Combobox.PointerDownOutsideEvent) => void

    Function called when the pointer is pressed down outside the component

    onSelect?: (details: SelectionDetails) => void

    Function called when an item is selected

    onValueChange?: (details: ValueChangeDetails<T>) => void

    Function called when a new item is selected

    open?: boolean

    The controlled open state of the combobox

    openOnChange?: boolean | ((details: InputValueChangeDetails) => boolean)

    Whether to show the combobox when the input value changes

    true
    
    openOnClick?: boolean

    Whether to open the combobox popup on initial click on the input

    false
    
    openOnKeyPress?: boolean

    Whether to open the combobox on arrow key press

    true
    
    placeholder?: string

    The placeholder text of the combobox's input

    positioning?: PositioningOptions

    The positioning options to dynamically position the menu

    { placement: "bottom-start" }
    
    readOnly?: boolean

    Whether the combobox is readonly. This puts the combobox in a "non-editable" mode but the user can still interact with it

    required?: boolean

    Whether the combobox is required

    scrollToIndexFn?: (details: ScrollToIndexDetails) => void

    Function to scroll to a specific index

    selectionBehavior?: "clear" | "replace" | "preserve"

    The behavior of the combobox input when an item is selected

    • replace: The selected item string is set as the input value
    • clear: The input value is cleared
    • preserve: The input value is preserved
    "replace"
    
    translations?: IntlTranslations

    Specifies the localized strings that identifies the accessibility elements and their states

    value?: string[]

    The controlled value of the combobox's selected items