Dropdown

The use of dropdowns has its advantages but it depends on the screen support. Dropdowns are a standard widget, so the users know how to interact with them. The options available in a dropdown component are static, preventing erroneous data entered by the user since it only shows a range of correct values for that input.

Props

NameTypeDescriptionDefault
Required
options
{ label?: string; icon?: string | (React.ReactNode & React.SVGProps <SVGSVGElement>); value: string }[]An array of objects representing the options. Each object has the following properties:
  • label: Option display value.
  • icon: Material Symbol name or SVG element as the icon that will be placed next to the option label. When using Material Symbols, replace spaces with underscores. By default they are outlined if you want it to be filled prefix the symbol name with "filled_".
  • value: Option inner value.
-
optionsIconPosition'before' | 'after'In case options include icons, whether the icon should appear after or before the label.'before'
iconstring | (React.ReactNode & React.SVGProps <SVGSVGElement>)Material Symbol name or SVG element as the icon that will be placed next to the dropdown label. When using Material Symbols, replace spaces with underscores. By default they are outlined if you want it to be filled prefix the symbol name with "filled_".-
iconPosition'before' | 'after'Whether the icon should appear after or before the label.'before'
labelstringText to be placed within the dropdown.-
caretHiddenbooleanWhether the arrow next to the label must be displayed or not.false
disabledbooleanIf true, the component will be disabled.false
expandOnHoverbooleanIf true, the options are shown when the dropdown is hovered.false
Required
onSelectOption
(value: string) => voidThis function will be called every time the selection changes. The value of the selected option will be passed as a parameter.-
margin'xxsmall' | 'xsmall' | 'small' | 'medium' | 'large' | 'xlarge' | 'xxlarge' | MarginSize of the margin to be applied to the component. You can pass an object with 'top', 'bottom', 'left' and 'right' properties in order to specify different margin sizes.-
size'small' | 'medium' | 'large' | 'fillParent' | 'fitContent'Size of the component.'fitContent'
tabIndexnumberValue of the tabindex attribute.0

Examples

Basic usage

Icons