跳到主要内容

IComboBox

Custom combo box input.

comboboxcombobox

Example​

Multi-language selector with toast notifications

const languageSelector: IComboBox = {
options: [
{
key: "en-US",
label: "English (US)",
icon: "language-en.svg"
},
{
key: "es-ES",
label: "Español",
icon: "language-es.svg"
},
{
key: "fr-FR",
label: "Français",
icon: "language-fr.svg",
disabled: true
}
],
selectedOption: {
key: "en-US",
label: "English (US)",
icon: "language-en.svg"
},
onSelect: (item) => {
return {
actions: [Actions.updateProps, Actions.showToast],
newProps: {
selectedOption: item
},
toastProps: [{
title: `Interface language changed to ${item.label}`,
type: ToastType.success
}]
};
},
scaled: true,
directionX: "right",
directionY: "bottom",
displayType: "default",
dropDownMaxHeight: 300,
showDisabledItems: true,
withBackdrop: true,
isDisabled: false,
noBorder: false,
opened: false,
scaledOptions: true,
modernView: true
}

Properties​

PropertyTypeDescription
optionsIComboBoxItem[]Defines the combo box options
selectedOptionIComboBoxItemDefines the combo box selected option
onSelect(item: IComboBoxItem) => void | IMessageSets a function which is triggered whenever the combo box is selected
scaledbooleanSpecifies that the combo box is scaled by its parent
directionX"left" | "right"Defines the position of the combo box in the X direction
directionY"both" | "top" | "bottom"Defines the position of the combo box in the Y direction
displayType"default" | "toggle"Defines the combo box display type
modernViewbooleanSpecifies whether to display the combo box in the modern view
isDisabledbooleanSpecifies if the combo box is disabled or not
showDisabledItemsbooleanWhether to show disabled combo box options
openedbooleanSpecifies whether to open the combo box
scaledOptionsbooleanSpecifies whether the combo box options are scaled by the combo box button
onToggle() => void | IMessageSets a function which is triggered whenever the combo box is clicked when "displayType == toggle"
noBorderbooleanSpecifies whether to display the combo box without borders
withBackdropbooleanSpecifies whether the combo box contains a backdrop
classNamestringDefines the CSS class for styling the component. Can be used to override or extend the default component styles.

IComboBoxItem​

Custom combo box option.

Example​

Basic language option with icon

const languageOption: IComboBoxItem = {
key: "en-US",
label: "English (US)",
icon: "language-en.svg",
disabled: false
}

Properties​

PropertyTypeDescription
keystringUnique identifier for the option
labelstringDisplay text for the option
iconstringThe option display icon. The icon image must be uploaded to the assets folder. Only the image name with the extension must be specified in this field.
disabledbooleanSpecifies if the combo box option is disabled or not