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.
<o-button></o-button>
Props
Prop name | Description | Type | Values | Default |
---|---|---|---|---|
disabled | Button will be disabled | boolean | - | false |
expanded | Button will be expanded (full-width) | boolean | - | false |
iconLeft | Icon name to show on the left | string | - | |
iconPack | Icon pack to use | string | mdi , fa , fas and any other custom icon pack | From config: button: { |
iconRight | Icon name to show on the right | string | - | |
inverted | Enable inverted style | boolean | - | false |
label | Button label, unnecessary when default slot is used | string | - | |
loading | Enable loading style | boolean | - | false |
outlined | Enable outlined style | boolean | - | false |
override | Override existing theme classes completely | boolean | - | |
rounded | Enable rounded style | boolean | - | From config: button: { |
size | Size of the control | string | small , medium , large | From config: button: { |
tag | Button tag name | DynamicComponent | button , a , input , router-link , nuxt-link (or other nuxt alias) | From config: button: { |
type | Button type, like native | "button" | "reset" | "submit" | button , submit , reset | "button" |
variant | Color variant of the control | string | primary , info , success , warning , danger , and any other custom color | From config: button: { |
Events
Event name | Properties | Description |
---|---|---|
click | event Event - native event | button click event |
Slots
Name | Description | Bindings |
---|---|---|
default | Override the label, default is label prop |
Class Inspector
Class prop | Description | Props | Suffixes | |
---|---|---|---|---|
rootClass | Class of the root element. | |||
sizeClass | Class of the root element with size. | size | small | |
variantClass | Class of the root element with variant. | variant | primary | |
outlinedClass | Class of the root element when outlined. | outlined | primary | |
invertedClass | Class of the root element when inverted. | inverted | primary | |
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 | ||
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 Variable | Default |
---|---|
$button-background-color | transparent |
$button-color | var(--#{$prefix}black) |
$button-border-radius | var(--#{$prefix}base-border-radius) |
$button-border-color | var(--#{$prefix}grey-lighter) |
$button-border | 1px solid $button-border-color |
$button-box-shadow | none |
$button-font-weight | 400 |
$button-line-height | var(--#{$prefix}base-line-height) |
$button-margin-icon-to-text | 0.1875em |
$button-margin | 0 |
$button-spacer | 0.5rem |
$button-height | $control-height |
$button-padding | $control-padding-vertical 0.75em |
$button-rounded-border-radius | var( --#{$prefix}#{base-border-radius-rounded}) |
$button-disabled-opacity | var(--#{$prefix}#{base-disabled-opacity}) |
$button-outlined-background-color | transparent |
$button-outlined-border-color | var(--#{$prefix}grey-light) |
See ➜ 📄 Full scss file
Current theme ➜ Bulma
SASS Variable | Default |
---|---|
$button-shadow | css.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 Variable | Default |
---|---|
$btn-spacer | 0.5rem |
$btn-height | 2.35em |
$btn-border-color | var(--#{$prefix}border-color) |
$btn-hover-border-color | var(--#{$prefix}border-color) |
$btn-hover-box-shadow | $box-shadow-sm |
See ➜ 📄 Full scss file