Dropdown Menu
- Web Components
- Flutter
Demo
zeta-web v0.6.6
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
Slots
Name | Description | Type |
---|---|---|
default | The slotted text will be displayed on the dropdown menu button. | text |
Attributes
Name | Description | Type | Default |
---|---|---|---|
open | Controls the state of the dropdown menu. | boolean | false |
items | Array of items to populate the dropdown | Array\<ZetaDropdownItem\> | [ { label: "Auto Item", icon: "star", checked: false } ] |
type | The type of dropdown.- "text-dropdown" - A dropdown with a default dropdown buttons.- "checkbox-dropdown" - A dropdown with checkboxes.- "radio-dropdown" - A dropdown with radio buttons. | 'number' | 'text' | 'checkbox' | 'textarea' | 'password' | 'time' | 'date' | 'radio' | 'search' | 'text-dropdown' | 'checkbox-dropdown' | 'radio-dropdown' | 'slider' | 'range-selector' | 'select' | 'stepper' | "text-dropdown" |
direction | The direction of the droppable relative to the anchor. Defaults to bottom if left undefined. | "left" | "right" | "bottom" | "top" | undefined | "bottom" |
Inherited Attributes
Name | Description | Type | Default | Inherited From |
---|---|---|---|---|
flavor | Flavor of component.Values:_ primary - blue background._ secondary - yellow background._ positive - green background._ negative - red background._ outline - primary outline only._ outline-subtle - grey outline only.* text - primary text only. | 'primary' | 'secondary' | 'positive' | 'negative' | 'outline' | 'outline-subtle' | 'text' | "primary" | Flavored |
name | The name of the dropdown menu button for form control | 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 | "small" | "medium" | "large" | "medium" | Size |
Demo
Class for ZetaDropdown
Widgetbook
Inheritance
Object
> DiagnosticableTree
> Widget
> StatefulWidget
> ZetaStatefulWidget
Constructors
Creates a new ZetaDropdown.
ZetaDropdown.new({Key? key, bool? rounded, required List<ZetaDropdownItem<T>> items, ValueSetter<ZetaDropdownItem<T>>? onChange, T? value, ZetaDropdownMenuType type = ZetaDropdownMenuType.standard, ZetaDropdownSize size = ZetaDropdownSize.standard, Offset offset = Offset.zero, Widget builder(BuildContext context, ZetaDropdownItem<T>? selectedItem, ZetaDropdownController controller)?, VoidCallback? onDismissed, VoidCallback? onOpen, String? semanticDropdownLabel, bool disableButtonSemantics = false, ZetaDropdownMenuPosition? menuPosition})
Properties
Name | Description | Type | Features |
---|---|---|---|
builder | A custom builder for the child of the dropdown. | Widget Function(BuildContext context, ZetaDropdownItem<T>? selectedItem, ZetaDropdownController controller)? | final |
disableButtonSemantics | If true, Semantics will not include the button variable. | bool | final |
hashCode | The hash code for this object. | int | no setter inherited |
items | The items displayed in the dropdown. | List<ZetaDropdownItem<T>> | final |
key | Controls how one widget replaces another widget in the tree. | Key? | final inherited |
menuPosition | Override the direction the dropdown menu is rendered. | ZetaDropdownMenuPosition? | final |
offset | The offset of the dropdown menu from its parent. | Offset | final |
onChange | Called with the selected value whenever the dropdown is changed. | ValueSetter<ZetaDropdownItem<T>>? | final |
onDismissed | Called when the dropdown is dismissed. | VoidCallback? | final |
onOpen | Called when the dropdown is opened. | VoidCallback? | final |
rounded | Sets rounded or sharp border of the containing box and the icon style. | bool? | final inherited |
runtimeType | A representation of the runtime type of the object. | Type | no setter inherited |
semanticDropdownLabel | A semantic label for the dropdown. | String? | final |
size | The size of the dropdown menu. | ZetaDropdownSize | final |
type | The type of the dropdown menu. | ZetaDropdownMenuType | final |
value | The value of the selected item. | T? | final |
Methods
Name | Description | Type | Features |
---|---|---|---|
createElement() | Creates a StatefulElement to manage this widget's location in the tree. | StatefulElement | inherited |
createState() | Creates the mutable state for this widget at a given location in the tree. | State<ZetaDropdown<T>> | override |
debugDescribeChildren() | Returns a list of DiagnosticsNode objects describing this node's children. | List<DiagnosticsNode> | inherited |
debugFillProperties(DiagnosticPropertiesBuilder properties) | Add additional properties associated with the node. | void | override |
noSuchMethod(Invocation invocation) | Invoked when a nonexistent method or property is accessed. | dynamic | inherited |
paddingAll(double space) | Available on Widget, provided by the SpacingWidget extension | Widget | undefined |
paddingBottom(double space) | Available on Widget, provided by the SpacingWidget extension | Widget | undefined |
paddingEnd(double space) | Available on Widget, provided by the SpacingWidget extension | Widget | undefined |
paddingHorizontal(double space) | Available on Widget, provided by the SpacingWidget extension | Widget | undefined |
paddingStart(double space) | Available on Widget, provided by the SpacingWidget extension | Widget | undefined |
paddingTop(double space) | Available on Widget, provided by the SpacingWidget extension | Widget | undefined |
paddingVertical(double space) | Available on Widget, provided by the SpacingWidget extension | Widget | undefined |
toDiagnosticsNode({String? name, DiagnosticsTreeStyle? style}) | Returns a debug representation of the object that is used by debugging tools and by DiagnosticsNode.toStringDeep. | DiagnosticsNode | inherited |
toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) | A string representation of this object. | String | inherited |
toStringDeep({String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug, int wrapWidth = 65}) | Returns a string representation of this node and its descendants. | String | inherited |
toStringShallow({String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) | Returns a one-line detailed description of the object. | String | inherited |
toStringShort() | A short, textual description of this widget. | String | inherited |
Figma