Button
Introduction
The button component is a basic Mobi component that represents an operation command or a group of commands and responds to user clicks.
Configuration items
Category |
Configuration |
Example |
Description |
Content |
Button text |
The text displayed on the button. |
|
Button type |
Controls the style and behavior of the button. |
||
Enable logo |
Specifies whether to display the logo. |
||
Logo configuration |
If the logo is enabled, you can configure its properties. |
||
Hover tip |
Specifies whether to display a tip when the user hovers over the button. |
||
Hover tip configuration |
If the hover tip is enabled, you can configure its properties. |
||
Extension configuration |
Configure prefix and suffix icons for the button text. |
||
Interaction |
Hide |
Hides the component. For more information, see Common properties. |
|
Keep layout when hidden |
Keeps the layout space when the component is hidden. For more information, see Common properties. |
||
Interaction type |
The interaction type of the button. When the interaction type is Submit or Reset, the button automatically triggers a form submission or reset. |
||
Loading |
|
Displays a loading animation. |
|
Disable |
Specifies whether to disable the component. A disabled component is grayed out to indicate that it is inactive. |
||
Style |
Height |
The height of the component. For more information, see Common properties. |
|
Margin |
The margin of the component. For more information, see Common properties. |
||
Ghost style |
Specifies whether to use the ghost style. |
||
Danger button |
Marks the button as a danger button to emphasize a high-threat operation. This is typically used for buttons that involve data loss, account deletion, or other irreversible operations. |
||
Button shape |
The shape of the button. You can set the shape to default, circle, or rounded. |
||
Button layout |
The layout of the button within its container. Options: Full-width, Left, Center, Right. |
||
CSS Style |
CSS style |
Add a CSS style. |
|
Add CSS style |
You can apply different CSS styles to individual buttons. |
||
Border radius |
For more information, see Common 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 |
Sets the background color of the primary button in the active state. For more information, see Common properties. |
||
Primary button active text color |
Sets the text color of the primary button in the active state. This corresponds to the CSS color property. See the MDN documentation for details. |
||
Primary button hover background color |
Sets the background color of the primary button in the hover state. For more information, see Common properties. |
||
Primary button hover text color |
Sets the text color of the primary button in the hover state. This corresponds to the CSS color property. See the MDN documentation for details. |
||
Primary button background color |
Sets the background color of the primary button. For more information, see Common properties. |
||
Primary button text color |
Sets the text color of the primary button. This corresponds to the CSS color property. See the MDN documentation for details. |
||
Default button active background color |
Sets the background color of the default button in the active state. For more information, see Common properties. |
||
Default button active border color |
Sets the border color of the default button in the active state. This corresponds to the CSS border-color property. See the MDN documentation for details. |
||
Default button active text color |
Sets the text color of the default button in the active state. This corresponds to the CSS color property. See the MDN documentation for details. |
||
Default button hover background color |
Sets the background color of the default button in the hover state. For more information, see Common properties. |
||
Default button hover border color |
Sets the border color of the default button in the hover state. This corresponds to the CSS |
||
Default button hover text color |
Sets the text color of the default button in the hover state. This corresponds to the CSS |
||
Default button background color |
Sets the background color of the default button. For more information, see Common properties. |
||
Default button border color |
Sets the border color of the default button. This corresponds to the CSS |
||
Default button text color |
Sets the text color of the default button. This corresponds to the CSS |
||
Text button active background color |
Sets the background color of the text button in the active state. For more information, see Common properties. |
||
Text button disabled text color |
Sets the text color of the text button in the disabled state. This corresponds to the CSS color property. See the MDN documentation for details. |
||
Text button text color |
Sets the text color of the text button. This corresponds to the CSS color property. See the MDN documentation for details. |
||
Text button hover background color |
Sets the background color of the text button in the hover state. For more information, see Common properties. |
||
Link button active text color |
Sets the text color of the link button in the active state. This corresponds to the CSS color property. See the MDN documentation for details. |
||
Link button text color |
Sets the text color of the link button. This corresponds to the CSS color property. See the MDN documentation for details. |
||
Link button hover text color |
Sets the text color of the link button in the hover state. This corresponds to the CSS color property. See the MDN documentation for details. |
Properties and methods
Name |
Type |
Example |
Description |
text |
string |
|
The button text. |
setText |
func |
|
Sets the button text. |
clearText |
func |
|
Purge |
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 depending on the status. |
click |
func |
|
Click operation. |
Event callbacks
Event name |
Description |
The callback that is triggered when the component is clicked. |
