Button Controls
Material Design button components for creating interactive user interfaces.Button
A material button that supports various styles, colors, event handlers for user interaction, and can display text, icons, or both.Properties
The button’s label. Typically a
Text control or a string. If a string is provided, it will be wrapped in a Text control.At least one of icon or content (string or visible control) must be provided.The icon to display inside the button. Typically an
Icon control or an IconData. If an IconData is provided, it will be wrapped in an Icon control.At least one of icon or content (string or visible control) must be provided.The color of the icon. If not specified, defaults to the current foreground color.
The button’s foreground color. If not specified, defaults to the theme’s primary color.
The button’s background color. If not specified, defaults to the theme’s primary color.
The button’s elevation (shadow depth).
The button’s style configuration.
Whether this button should be focused initially.
The button’s clip behavior.
The URL to open when the button is clicked.
Events
Called when the button is clicked.
Called when the button is long-pressed.
Called when the button is hovered.
Called when the button is focused.
Called when the button loses focus.
Methods
Requests focus for this control.
Example
ElevatedButton
Deprecated: UseButton instead. This class is deprecated since version 0.80.0 and will be removed in version 1.0.
ElevatedButton is now an alias for Button and inherits all its properties and methods.
FilledButton
Filled buttons have the most visual impact after theFloatingActionButton, and are typically used for important, final actions that complete a flow, like “Save”, “Join now”, or “Confirm”.
Inherits all properties, events, and methods from Button.
Example
OutlinedButton
Outlined buttons are medium-emphasis buttons. They contain actions that are important, but aren’t the primary action in an app. Outlined buttons pair well with filled buttons to indicate an alternative, secondary action.Properties
A Control representing custom button content. At least one of
icon or content must be provided.An icon to display in this button.
Icon color.
The button’s style configuration.
True if the control will be selected as the initial focus. If there is more than one control on a page with autofocus set, then the first one added to the page will get focus.
The content will be clipped (or not) according to this option.
The URL to open when this button is clicked. Additionally, if
on_click event callback is provided, it is fired after that.Events
Called when a user clicks this button.
Called when this button is long-pressed.
Called when a mouse pointer enters or exists this button’s response area. The
data property of event object contains "true" (string) when cursor enters and "false" when it exits.Called when this button has received focus.
Called when this button has lost focus.
Methods
Requests focus for this control.
Example
TextButton
Text buttons are used for the lowest priority actions, especially when presenting multiple options. Text buttons can be placed on a variety of backgrounds. Until the button is interacted with, its container isn’t visible.Properties
A Control representing custom button content.
An icon to show in this button.
Icon color.
Defines the style of this button.
True if the control will be selected as the initial focus. If there is more than one control on a page with autofocus set, then the first one added to the page will get focus.
The URL to open when this button is clicked. Additionally, if
on_click event callback is provided, it is fired after that.Defines how the content of this button is clipped.
Events
Called when a user clicks this button.
Called when this button is long-pressed.
Called when a mouse pointer enters or exists this button’s response area. The
data property of the event handler argument is True when cursor enters and False when it exits.Called when this button has received focus.
Called when this button has lost focus.
Methods
Requests focus for this control.