Skip to main content

Combobox

    The Combobox component allows users to choose one option from a collapsed dropdown, filter options by typing, or create a new one.

    ComboboxProps

    Signature:

    export declare type ComboboxProps = <<< | , (value: | ) => , >, >> & & & & & & { /** * Called when the user creates a new option by typing a value not in the list. * Receives the trimmed input . * When `value` is controlled, `onChange` is not called for the created value; * set `value` in this callback to apply it. When uncontrolled, the value is * applied and `onChange` is called before this callback. */ onCreateOption?: (inputValue: ) => ; /** * Called when the open state of the dropdown changes. */ onOpenChange?: (isOpen: ) => ; /** * Placeholder text shown when no value is selected. * @defaultValue */ placeholder?: ; /** * Action word shown before the typed input in the option to create a new value. * For example, pass `` to render instead of the default . * @defaultValue */ createLabel?: ; };

    Combobox components​

    Combobox.Content​

    Combobox.Content wraps all options and groups. It's required.

    ComboboxContentProps

    Signature:

    export declare type ComboboxContentProps = <> & & & & { /** * When true, shows a loading spinner instead of options. * @defaultValue false */ loading?: ; };

    Combobox.Option​

    Every option of the Combobox is represented by the children of Combobox.Option.

    ComboboxOptionProps

    Signature:

    export declare type ComboboxOptionProps = & & & & { /** * The value submitted when this option is selected. */ value: ; /** * Plain-text label used for filtering and as the react-select option key when * `children` is a non- `ReactNode`. When omitted and `children` is a * plain , `children` is used automatically. */ textValue?: ; /** * Unique key for the option within the list. Defaults to `value` when omitted. */ id?: ; /** * Accessible label for the option, used when `children` is not descriptive enough for screen readers. */ ?: ; /** * When `true`, the option is visible but cannot be selected. */ disabled?: ; };

    Combobox.Group​

    Use Combobox.Group to organize options into groups.

    ComboboxGroupProps

    Signature:

    export declare type ComboboxGroupProps = <> & & & ;

    Combobox.GroupLabel​

    Add a Combobox.GroupLabel inside each Combobox.Group to name the group.

    ComboboxGroupLabelProps

    Signature:

    export declare type ComboboxGroupLabelProps = <> & & & ;

    Combobox.Prefix​

    Combobox.Prefix can only be used inside Combobox.Option.

    ComboboxPrefixProps

    Signature:

    export declare type ComboboxPrefixProps = & & & ;

    Combobox.Suffix​

    Combobox.Suffix can only be used inside Combobox.Option.

    ComboboxSuffixProps

    Signature:

    export declare type ComboboxSuffixProps = & & & ;
    Still have questions?
    Find answers in the Dynatrace Community