Button

Commonly used button.

Basic usage

Disabled Button

The disabled attribute determines if the button is disabled.

WARNING

type="text" has been deprecated, and will be removed in3.0.0, consider switching to new API.

New API link has been added in2.2.1, you can use type API to set the theme of your link button

Text Button

TIP

Text button has been upgraded with a new design since 2.2.0 , if you want to use the previous version like button, you might want to check Link out.

The API is also updated, because the type attribute also represents the button's style. So we have to make a new API text: boolean for text button.

Buttons without border and background.

Icon Button

Use icons to add more meaning to Button. You can use icon alone to save some space, or use it with text.

Button Group

Displayed as a button group, can be used to group a series of similar operations.

Loading Button

Click the button to load data, then the button displays a loading state.

Set loading attribute to true to display loading state.

TIP

You can use the loading slot or loadingIcon to customize your loading component

ps: loading slot has higher priority than loadingIcon

Sizes

Besides default size, Button component provides three additional sizes for you to choose among different scenarios.

Custom Colorbeta

You can custom button color.

We will calculate hover color & active color automatically.

Button API

Button Attributes

NameDescriptionTypeDefault
sizebutton sizestring
typebutton typestring
plaindetermine whether it's a plain buttonbooleanfalse
text2.2.0determine whether it's a text buttonbooleanfalse
bg2.2.0determine whether the text button background color is always onbooleanfalse
link2.2.1determine whether it's a link buttonbooleanfalse
rounddetermine whether it's a round buttonbooleanfalse
circledetermine whether it's a circle buttonbooleanfalse
loadingdetermine whether it's loadingbooleanfalse
loading-iconcustomize loading icon componentstring / ComponentLoading
disableddisable the buttonbooleanfalse
iconicon componentstring / Component
autofocussame as native button's autofocusbooleanfalse
native-typesame as native button's typestringbutton
auto-insert-spaceautomatically insert a space between two chinese charactersboolean
colorcustom button color, automatically calculate hover and active colorstring
darkdark mode, which automatically converts color to dark mode colorsbooleanfalse

Button Slots

NameDescription
defaultcustomize default content
loadingcustomize loading component
iconcustomize icon component

Button Exposes

NameDescriptionType
refbutton html elementObject
sizebutton sizeObject
typebutton typeObject
disabledbutton disabledObject
shouldAddSpacewhether adding spaceObject

ButtonGroup API

ButtonGroup Attributes

NameDescriptionTypeDefault
sizecontrol the size of buttons in this button-groupstring
typecontrol the type of buttons in this button-groupstring

ButtonGroup Slots

NameDescriptionSubtags
defaultcustomize button group contentButton

Source

ComponentDocs

Contributors