Button
Brief Introduction
The button component is a fundamental interactive element for common operations, such as form submission. You can use <MYButton></MYButton> or <MYButton /> to implement a button.
About Color Usage
type
Using type in MYButton defines the button's color. These colors are the basic definitions provided by mengyue-components. For example, use type to achieve the following color definitions. If type is not specified, the default is a transparent color:
colorBg
If the above colors do not meet your needs, you can customize the color. Use colorBg to customize the button background color. For example, using a red background here:
colorText
The MYButton also supports custom text color. Use colorText to customize the button's text color.
colorBorder
Customize the button border color. Use colorBorder to customize the button's border color.
plain
Use the plain attribute to render the button with a transparent style, which can be combined with the custom colors above to achieve unique appearances.
About Border Radius
round
Use round to make the button have rounded corners.
circle
Use circle to make the button circular.
About Size
size
Use the size attribute to adjust the button size.
About Disabled
disabled
Use disabled to disable the button.
Insert Icon
Use the icon property or the default slot to insert an icon into the button.
Finally, combine multiple APIs to create a customized button:
API Reference
Props
| Parameter | Description | Type | Optional Values | Default |
|---|---|---|---|---|
| type | Button type | string | primary / success / warning / danger / info | — |
| size | Button size | string | supersmall / small / medium / large / superbig | medium |
| plain | Whether it's a plain button | boolean | — | false |
| round | Whether it's a rounded button | boolean | — | false |
| circle | Whether it's a circular button | boolean | — | false |
| disabled | Whether disabled | boolean | — | false |
| colorBg | Background color | string | Supports hex colors or named colors | — |
| colorText | Text color | string | Supports hex colors or named colors | — |
| colorBorder | Border color | string | Supports hex colors or named colors | — |
| tag | Render tag | string | Supports all HTML tags | button |
Type Definition
interface ButtonProps {
type?: string;
size?: string;
plain?: boolean;
round?: boolean;
circle?: boolean;
disabled?: boolean;
colorBg?: string;
colorText?: string;
colorBorder?: string;
iconOnly?: boolean;
tag?: string;
}