Form constructor

Form({
  1. Object? child,
  2. List<Object?> children = const [],
  3. String? method,
  4. String? action,
  5. bool disabled = false,
  6. bool loading = false,
  7. String? className,
  8. Map<String, Object?> props = const {},
  9. Map<String, Object?> style = const {},
  10. DartStyle? dartStyle,
  11. void onSubmit(
    1. Object event
    )?,
})

Creates a form around child fields and actions.

Implementation

Form({
  Object? child,
  List<Object?> children = const [],
  String? method,
  String? action,
  bool disabled = false,
  bool loading = false,
  String? className,
  Map<String, Object?> props = const {},
  Map<String, Object?> style = const {},
  DartStyle? dartStyle,
  void Function(Object event)? onSubmit,
}) : super(
        'form',
        props: mergeComponentProps(
          {
            ...props,
            if (method != null) 'method': method,
            if (action != null) 'action': action,
            if (disabled) 'aria-disabled': 'true',
            if (loading) 'aria-busy': 'true',
            if (onSubmit != null) 'onSubmit': onSubmit,
          },
          className: className,
          defaultStyle: const {'display': 'grid', 'gap': '16px'},
          dartStyle: dartStyle,
          style: style,
        ),
        children: normalizeChildren(child, children),
      );