Toggle button
Introduction
The toggle button is a basic Moflow component that switches between two states. Clicking the button toggles its state, typically between 'on' and 'off'.
Configuration items
Category |
Configuration |
Example |
Description |
Content |
Default value |
Specifies whether the button is in the 'on' state. |
|
Button text |
The text displayed on the button. |
||
Button type |
Controls the style and behavior of the button. Options: Primary, Default, Dashed, Text, and Link. |
||
Enable logo |
Specifies whether to display a logo. |
||
Logo configuration |
Configure the properties of the logo after you enable it. |
||
Tooltip |
Specifies whether to display a tooltip. |
||
Tooltip configuration |
Configure the properties of the tooltip after you enable it. |
||
Icon mode |
Sets the icon mode. Options: Fixed icon and Custom icon. |
||
Fixed icon |
Sets one of three predefined icon types. |
||
Custom icon |
Set a custom icon. |
||
Icon (True) |
Set the icon for the True state. |
||
Icon (False) |
Set the icon for the False state. |
||
Interaction |
Hide |
Hides the component. For more information, see General properties. |
|
Keep layout when hidden |
Specifies whether to keep the layout when the component is hidden. |
||
Loading |
Displays a loading animation. |
||
Disable |
Controls whether the component is disabled. A disabled component is grayed out to indicate that it is unavailable. |
||
Style |
Height |
The height of the component. For more information, see General properties. |
|
Margin |
The margin of the component. For more information, see General properties. |
||
Icon position |
Sets the position of the icon. Options: Right of text, Left of text, and Replace text. |
||
Ghost style |
|
Specifies whether to display the ghost style. |
|
Danger button |
Displays a danger mark on the button. This emphasizes a high-threat operation. It is typically used for buttons that involve data loss, account deletion, or other irreversible operations. |
||
Button shape |
The shape of the button. Options: Default, Circle, and Rounded. |
||
Button layout |
The layout of the button within its container. Options: Block, Left, Center, and Right. |
||
CSS style |
Border radius |
For more information, see General properties. |
|
Button content font size |
The font size of the button content. |
||
Button content line height |
The line height of the button content. |
||
Primary button active background color |
For more information, see General properties. |
||
Primary button active text color |
Sets the text color. This corresponds to the CSS property: color. For more information, see the MDN documentation. |
||
Primary button hover background color |
For more information, see General properties. |
||
Primary button hover text color |
Sets the text color. This corresponds to the CSS property: color. For more information, see the MDN documentation. |
||
Primary button background color |
For more information, see General properties. |
||
Primary button text color |
Sets the text color. This corresponds to the CSS property: color. For more information, see the MDN documentation. |
||
Default button active background color |
For more information, see General properties. |
||
Default button active border color |
For more information, see General properties. |
||
Default button active text color |
Sets the text color. This corresponds to the CSS property: color. For more information, see the MDN documentation. |
||
Default button hover background color |
For more information, see General properties. |
||
Default button hover border color |
For more information, see General properties. |
||
Default button hover text color |
Sets the text color. This corresponds to the CSS property: color. For more information, see the MDN documentation. |
||
Default button background color |
For more information, see General properties. |
||
Default button border color |
For more information, see General properties. |
||
Default button text color |
Sets the text color. This corresponds to the CSS property: color. For more information, see the MDN documentation. |
||
Text button active background color |
For more information, see General properties. |
||
Text button disabled text color |
Sets the text color. This corresponds to the CSS property: color. For more information, see the MDN documentation. |
||
Text button text color |
Sets the text color. This corresponds to the CSS property: color. For more information, see the MDN documentation. |
||
Text button hover background color |
For more information, see General properties. |
||
Link button active text color |
Sets the text color. This corresponds to the CSS property: color. For more information, see the MDN documentation. |
||
Link button text color |
Sets the text color. This corresponds to the CSS property: color. For more information, see the MDN documentation. |
||
Link button hover text color |
For more information, see General properties. |
Properties and methods
Name |
Type |
Example |
Description |
value |
boolean |
|
The default value. |
setValue |
func |
|
Sets the default value. |
clearValue |
func |
|
Clears the value of the component. |
text |
string |
|
The button text. |
setText |
func |
|
Sets the button text. |
clearText |
func |
|
Text on the Clear button |
loading |
boolean |
|
The loading state of the button. |
setLoading |
func |
|
Sets the loading state of the button. |
disabled |
boolean |
|
Specifies whether the button is disabled. |
setDisabled |
func |
|
Sets whether the button is disabled. |
clearDisabled |
func |
|
The Purge button is disabled because of the current status. |
click |
func |
|
Click |
Event callbacks
Event name |
Description |
The callback for a click event on the component. |
