label function

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

The <label> HTML element represents a caption for an item in a user interface.

  • htmlFor: The value of the for attribute must be a single id for a labelable form-related element in the same document as the <label> element. So, any given label element can be associated with only one form control.

Implementation

Component label(List<Component> children,
    {String? htmlFor,
    Key? key,
    String? id,
    String? classes,
    Styles? styles,
    Map<String, String>? attributes,
    Map<String, EventCallback>? events}) {
  return DomComponent(
    tag: 'label',
    key: key,
    id: id,
    classes: classes,
    styles: styles,
    attributes: {
      ...attributes ?? {},
      if (htmlFor != null) 'for': htmlFor,
    },
    events: events,
    children: children,
  );
}