button function
The <button> HTML element is an interactive element activated by a user with a mouse, keyboard, finger, voice command, or other assistive technology. Once activated, it then performs a programmable action, such as submitting a form or opening a dialog.
autofocus
: Specifies that the button should have input focus when the page loads. Only one element in a document can have this attribute.disabled
: Prevents the user from interacting with the button: it cannot be pressed or focused.type
: The default behavior of the button.onClick
: Callback for the 'click' event.
Implementation
Component button(List<Component> children,
{bool? autofocus,
bool? disabled,
ButtonType? type,
VoidCallback? onClick,
Key? key,
String? id,
String? classes,
Styles? styles,
Map<String, String>? attributes,
Map<String, EventCallback>? events}) {
return DomComponent(
tag: 'button',
key: key,
id: id,
classes: classes,
styles: styles,
attributes: {
...attributes ?? {},
if (autofocus == true) 'autofocus': '',
if (disabled == true) 'disabled': '',
if (type != null) 'type': type.value,
},
events: {
...?events,
..._events(onClick: onClick),
},
children: children,
);
}