Skip to content

Button

Button component enhanced based on Element Plus Button with support for Iconify icons.

Basic Usage

Use type, plain, round, circle and icon to define button styles. (The icon prop supports both Element Plus icons and Iconify icon names (e.g., 'tabler:refresh').)

Disabled Button

The disabled attribute determines if the button is disabled.

Use disabled attribute to determine whether a button is disabled. It accepts a Boolean value.

WARNING

type="text" has been deprecated, Element Plus and will be removed in 3.0.0, consider switching to new API.

New API link has been added in Element Plus 2.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, 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 Element Plus 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.

Use the icon attribute to add icon. You can use Iconify icon names (for example, 'tabler:home') or find the icon list in the Element Plus icon component. Adding icons to the right side of the text is achievable with an <i> tag. Custom icons can be used as well. The following example uses Iconify.

Button Group

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

Use tag <el-button-group> to group your buttons.

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.

Use attribute size to set additional sizes with large, small.

Tag

You can custom element tag, For example button, div, a, router-link, nuxt-link.

Button API

Button Attributes

NameDescriptionTypeDefault
iconIcon component or iconify icon namestring / Component
loading-iconcustomize loading icon componentstring / ComponentLoading
Element Plus Button Attributes
NameDescriptionTypeDefault
sizebutton sizeenum
typebutton type, when setting color, the latter prevailsenum
plaindetermine whether it's a plain buttonbooleanfalse
textdetermine whether it's a text buttonbooleanfalse
bgdetermine whether the text button background color is always onbooleanfalse
linkdetermine 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 typeenumbutton
auto-insert-spaceautomatically insert a space between two chinese characters(this will only take effect when the text length is 2 and all characters are in Chinese.)booleanfalse
colorcustom button color, automatically calculate hover and active colorstring
darkdark mode, which automatically converts color to dark mode colorsbooleanfalse
tagcustom element tagstring / Componentbutton

Button Slots

Element Plus Button Slots
NameDescription
defaultcustomize default content
loadingcustomize loading component
iconcustomize icon component

Button Exposes

Element Plus Button Exposes
NameDescriptionType
refbutton html elementobject
sizebutton sizeobject
typebutton typeobject
disabledbutton disabledobject
shouldAddSpacewhether adding spaceobject

ButtonGroup API

ButtonGroup Attributes

Element Plus ButtonGroup Attributes
NameDescriptionTypeDefault
sizecontrol the size of buttons in this button-groupenum
typecontrol the type of buttons in this button-groupenum
directiondisplay directionenumhorizontal

ButtonGroup Slots

Element Plus ButtonGroup Slots
NameDescriptionSubtags
defaultcustomize button group contentButton

Released under the MIT License.