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 supports 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.

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:
Class propDescriptionPropsSuffixes
rootClassClass of the root element.
sizeClassClass of the root element with size.sizesmall
medium
large
variantClassClass of the root element with variant.variantprimary
info
warning
danger
outlinedClassClass of the root element when outlined.outlinedprimary
info
warning
danger
invertedClassClass of the root element when inverted.invertedprimary
info
warning
danger
loadingClassClass of the root element when loading.loading
expandedClassClass of the root element when expanded.expanded
roundedClassClass of the root element when rounded.rounded
disabledClassClass of the button when disabled.disabled
wrapperClassClass of the inner wrapper element.
iconClassClass of the icon element.iconLeft
iconRight
iconLeftClassClass of the icon element on the left.iconLeft
iconRightClassClass of the icon element on the right.iconRight
labelClassClass of the label element.

Sass variables

Current theme ➜ Oruga

SASS VariableDefault
$button-background-colortransparent
$button-colorvar(--#{$prefix}black)
$button-border-radiusvar(--#{$prefix}base-border-radius)
$button-border-colorvar(--#{$prefix}grey-lighter)
$button-border1px solid $button-border-color
$button-box-shadownone
$button-font-weight400
$button-line-heightvar(--#{$prefix}base-line-height)
$button-margin-icon-to-text0.1875em
$button-margin0
$button-spacer0.5rem
$button-height$control-height
$button-padding$control-padding-vertical 0.75em
$button-rounded-border-radiusvar( --#{$prefix}#{base-border-radius-rounded})
$button-disabled-opacityvar(--#{$prefix}#{base-disabled-opacity})
$button-outlined-background-colortransparent
$button-outlined-border-colorvar(--#{$prefix}grey-light)

See ➜ 📄 Full scss file

Current theme ➜ Bulma

SASS VariableDefault
$button-shadowcss.getVar("focus-shadow-size") hsla( css.getVar("button-h"), css.getVar("button-s"), css.getVar("button-l"), css.getVar("focus-shadow-alpha") )

See ➜ 📄 Full scss file

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 ➜ 📄 Full scss file

Released under the MIT License.