Skip to content

Button

The Button component uses HTML's native button element by default. The label prop is used to populate the text of the button — or alternatively you can use the default slot. The button can be have different colors, sizes, and states. The component implements the W3C ARIA APG Button Pattern.

Examples

Base

States

Variants

Different styles can be achieved with the variant prop.

Outlined

Use the outlined prop in combination with the variant prop for a lightweight look.

Inverted

Use the inverted prop in combination with the variant prop for a clickable label look.

Sizes

The component can be displayed in different sizes using the size prop.

Icons

Add an icon to the button to explain its function more visually.

Tags

Instead of using the HTML button tag, the HTML tag can be customised using the tag prop, for example to define links using vue-router and router-link tag.

Button Component

The classic button, in different colors, sizes, and states.

html
<o-button></o-button>

Props

Prop nameDescriptionTypeValuesDefault
disabledButton will be disabledboolean-false
expandedButton will be expanded (full-width)boolean-false
iconLeftIcon name to show on the leftstring-
iconPackIcon pack to usestringmdi, fa, fas and any other custom icon pack
From config:
button: {
  iconPack: undefined
}
iconRightIcon name to show on the rightstring-
invertedEnable inverted styleboolean-false
labelButton label, unnecessary when default slot is usedstring-
loadingEnable loading styleboolean-false
outlinedEnable outlined styleboolean-false
overrideOverride existing theme classes completelyboolean-
roundedEnable rounded styleboolean-
From config:
button: {
  rounded: false
}
sizeSize of the controlstringsmall, medium, large
From config:
button: {
  size: undefined
}
tagButton tag nameDynamicComponentbutton, a, input, router-link, nuxt-link (or other nuxt alias)
From config:
button: {
  tag: "button"
}
typeButton type, like native"button" | "reset" | "submit"button, submit, reset"button"
variantColor variant of the controlstringprimary, info, success, warning, danger, and any other custom color
From config:
button: {
  variant: undefined
}

Events

Event namePropertiesDescription
clickevent Event - native eventbutton click event

Slots

NameDescriptionBindings
defaultOverride the label, default is label prop

Class Inspector

Classes applied to the element:
Want to know how does the Class Inspector work?
Class propDescriptionPropsSuffixes
rootClass
Class of the root element.
sizeClass
Class of the root element with size.
sizesmall
medium
large
variantClass
Class of the root element with variant.
variantprimary
info
warning
danger
outlinedClass
Class of the root element when outlined.
outlinedprimary
info
warning
danger
invertedClass
Class of the root element when inverted.
invertedprimary
info
warning
danger
loadingClass
Class of the root element when loading.
loading
expandedClass
Class of the root element when expanded.
expanded
roundedClass
Class of the root element when rounded.
rounded
disabledClass
Class of the button when disabled.
disabled
wrapperClass
Class of the inner wrapper element.
iconClass
Class of the icon element.
iconLeft
iconRight
iconLeftClass
Class of the icon element on the left.
iconLeft
iconRightClass
Class of the icon element on the right.
iconRight
labelClass
Class of the label element.

Sass Variables

Current theme ➜ Oruga

SASS VariableDefault
$button-spacerh.useVar("control-spacer")
$button-heighth.useVar("control-height")
$button-paddingh.useVar("control-padding-vertical") h.useVar("control-padding-horizontal")
$button-loading-animation-durationh.useVar("animation-speed-slow")
$button-disabled-opacityh.useVar("control-disabled-opacity")
$button-colorh.useVar("font-color")
$button-font-sizeh.useVar("font-size")
$button-font-weighth.useVar("font-weight")
$button-line-heighth.useVar("line-height")
$button-box-shadownone
$button-border-widthh.useVar("control-border-width")
$button-border-stylesolid
$button-border-colorh.useVar("control-border-color")
$button-border-radiush.useVar("border-radius")
$button-background-colorh.useVar("control-brackground-color")
$button-hover-color$button-color
$button-hover-background-color$button-background-color
$button-hover-border-colorh.useVar("grey-light")
$button-outlined-background-colortransparent
$button-outlined-border-colorh.useVar("grey-light")

See ➜ 📄 SCSS file

Current theme ➜ Bulma

The theme does not have any custom variables for this component.

Current theme ➜ Bootstrap

SASS VariableDefault
$btn-spacer0.5rem
$btn-height2.35em
$btn-border-colorvar(--#{$prefix}border-color)
$btn-hover-border-colorvar(--#{$prefix}border-color)
$btn-hover-box-shadow$box-shadow-sm

See ➜ 📄 SCSS file

Released under the MIT License.