optgroup function

Component optgroup(
  1. List<Component> children, {
  2. required String label,
  3. bool? disabled,
  4. Key? key,
  5. String? id,
  6. String? classes,
  7. Styles? styles,
  8. Map<String, String>? attributes,
  9. Map<String, EventCallback>? events,
})

The <optgroup> HTML element creates a grouping of options within a <select> element.

  • label: The name of the group of options, which the browser can use when labeling the options in the user interface.
  • disabled: If this attribute is set, none of the items in this option group is selectable. Often browsers grey out such control and it won't receive any browsing events, like mouse clicks or focus-related ones.

Implementation

Component optgroup(List<Component> children,
    {required String label,
    bool? disabled,
    Key? key,
    String? id,
    String? classes,
    Styles? styles,
    Map<String, String>? attributes,
    Map<String, EventCallback>? events}) {
  return DomComponent(
    tag: 'optgroup',
    key: key,
    id: id,
    classes: classes,
    styles: styles,
    attributes: {
      ...attributes ?? {},
      'label': label,
      if (disabled == true) 'disabled': '',
    },
    events: events,
    children: children,
  );
}