Dropdown#

Github

Dropdown is typically used to display a set of options that appear when the user clicks or hovers over a trigger element. Users can select an option from the dropdown menu, which is commonly used for navigation or other scenarios where multiple options need to be provided.

import { Dropdown, DropdownButton, DropdownGroup, DropdownRadioGroup, DropdownCheckboxGroup, DropdownItem, } from "wis/dropdown"

API Reference#

NameTypeDefaultDescription
defaultOpenbooleannoneThe open state of the dropdown menu when it is initially rendered.
openbooleannoneThe controlled open state of the dropdown menu. Must be used in conjunction with onOpen.
textstringnoneThe text information displayed on the dropdown menu.
descriptionstringnoneDescribe the dropdown menu.
disabledbooleanfalseWhen true, prevents the user from interacting with the dropdown.
iconReactNodenoneThe icon element will be displayed next to the dropdown menu text.
avatarAvatarnoneThe avatar element will be displayed next to the dropdown menu text.
arrowDirectiondown rightdownThe controlled dropdown menu arrow direction.
onOpen(open: boolean) => voidnoneEvent handler called when the dropdown menu is open state change.
NameTypeDefaultDescription
defaultOpenbooleannoneThe open state of the dropdown menu when it is initially rendered.
openbooleannoneThe controlled open state of the dropdown menu. Must be used in conjunction with onOpen.
textstringnoneThe text information displayed on the dropdown menu.
variantprimary classic secondarysecondaryThe visual variant to apply to dropdown button.
disabledbooleanfalseWhen true, prevents the user from interacting with the dropdown button.
iconReactNodefalseThe icon element will be displayed next to the dropdown button text.
iconControlprefix suffixprefixControls the display position of the icon relative to the text.
sizemd sm xsmdThe size of the dropdown button.
shortcutKeystringnoneSets a global shortcut key, such as Control+I. When the user presses the combination key, the dropdown button click event will be triggered. View Keyboard
onOpen(open: boolean) => voidnoneEvent handler called when the dropdown menu is open state change.
NameTypeDefaultDescription
titlestringnoneThe group title text will show at the beginning of the group.
onSelect(value: string) => voidnoneEvent handler called when group item click.
NameTypeDefaultDescription
namestringnoneThe unique name of group.
titlestringnoneThe group title text will show at the beginning of the group.
valuestringnoneThe value of selected item in the group. Must be used in conjunction with onChecked.
defaultValuestringnoneThe default value of selected item in the group.
onChange(value: string) => voidnoneEvent handler called when group item click.
NameTypeDefaultDescription
namestringnoneThe unique name of group.
titlestringnoneThe group title text will show at the beginning of the group.
valuestring[]noneThe value of selected item in the group. Must be used in conjunction with onChange.
defaultValuestring[]noneThe default value of selected item in the group.
onChange(value: string[]) => voidnoneEvent handler called when group item click.
NameTypeDefaultDescription
labelstringnoneThe text information displayed on the item.
valuestringnoneThe unique value of the item.
statusdangernoneSets the special status of the item.
disabledbooleanfalseWhen true, prevents the user from interacting with the dropdown item.
iconReactNodenoneThe icon element will be displayed next to the dropdown item text.
shortcutKeystringnoneSets a global shortcut key, such as Control+I. When the user presses the combination key, the dropdown item's click event will be triggered. View Keyboard
onClick(event: Event) => voidnoneEvent handler called when the user select an item (via mouse or keyboard).