Dropdown Menu
Dropdown menus allow users to select an option from a list that appears when the menu is clicked or tapped.
Figma Link
- Web Components
- Flutter
Demo
zeta-web v1.4.0
Web Components
Zeta Dropdown Menu Button places a button that when clicked opens a dropdown menu containing the items passed into it through the items prop.
Storybook
https://design.zebra.com/web/storybook/?path=/docs/components-dropdown--docs
Attributes
| Name | Description | Type | Default |
|---|---|---|---|
| matchParentWidth | Whether the dropdown menu should match the width of its parent. Enabled by default. If disabled, the dropdown menu will size to fit its content. | boolean | true |
| buttonTextMatchesSelected | Whether the button text should update to match the selected item. Default is true. Only applicable for the text-dropdown type. | boolean | true |
| defaultText | The default text to display when no item is selected. Defaults to an empty string if nothing is set. | string | "" |
| open | Controls the state of the dropdown menu. Default is false. | boolean | false |
| items | Array of items to populate the dropdown. Includes label, icon (optional), checked (optional), disabled (optional), and onClick (optional) properties. | Array\<ZetaDropdownItem\> | [ { label: "Auto Item", icon: undefined, checked: false } ] |
| type | The type of dropdown. Options are "text-dropdown", "checkbox-dropdown", and "radio-dropdown". Default is "text-dropdown". | 'checkbox-dropdown' | 'radio-dropdown' | 'text-dropdown' | "text-dropdown" |
| direction | The direction of the droppable relative to the anchor. Defaults to bottom if left undefined. | "left" | "right" | "bottom" | "top" | "bottom" |
Inherited Attributes
| Name | Description | Type | Default | Inherited From |
|---|---|---|---|---|
| flavor | The flavor of the dropdown button. Default is "primary". | 'primary' | 'positive' | 'negative' | 'outline' | 'outline-subtle' | 'text' | 'subtle' | "primary" | Flavored |
| name | The name of the dropdown menu button for form control. Default is "default". | string | "default" | FormField |
| autoCapitalize | Whether inputted text is automatically capitalized and how. Only takes effect on non-keyboard entry | "none" | "off" | "sentences" | "on" | "words" | "characters" | undefined | undefined | FormField |
| autoComplete | AutoFill | undefined | undefined | FormField | |
| id | The id of the form control. | string | "" | FormField |
| required | Indicates whether the form control is required to be filled out before submitting the form. | boolean | false | FormField |
| value | The value of the Form Control that is submitted when part of a form. | string | null | null | FormField |
| checked | The state of the Switch or Checkbox that is submitted when part of a form. | boolean | undefined | FormField |
| indeterminate | The state of the Switch or Checkbox defined by a mixed or unknown state. | boolean | false | FormField |
| placeholder | Placeholder text shown when value is empty. | string | undefined | undefined | FormField |
| min | The minimum value for number inputs | number | undefined | undefined | FormField |
| max | The maximum value for number inputs | number | undefined | undefined | FormField |
| readOnly | Placeholder text shown when value is empty. | boolean | undefined | undefined | FormField |
| spellCheck | Whether to spellcheck the input | boolean | "default" | undefined | undefined | FormField |
| disabled | Boolean for if component is disabled.This will apply disabled styles. | boolean | false | FormField |
| rounded | Whether the component is rounded or sharp.When true, rounded will set the border radius of the first child, and any children with class 'contourable-target' to --radius-minimal.Otherwise, this value will be --radius-none. | boolean | undefined | true | Contourable |
| size | Size of component | SizeType | "medium" | Size |
Flutter component not available yet