Skip to content

Button

All in one button component. Configurable as a text button, icon button or link button taking vue-router props.

Playground

<bunt-button
:disabled
=""
icon
=""
tooltip
=""
:loading
=""
:error
=""
errorMessage
=""
:to
=""
>
</bunt-button>
--button-shape
:
--button-weight
:
--button-color
:
--button-color-error
:
--button-color-success
:
--button-text-color
:
--button-size
:
--tooltip-placement
:

API

Slots

SlotDescription
defaultButton text. Leave empty to render icon button.
iconUse this slot if you want to display a custom icon. For MDI icons, use the `icon` prop instead.

Props

PropertyTypeDefaultDescription
disabledbooleanfalse
iconstringMDI iconset name. To render just an icon button, leave default slot empty.
tooltipstring
loadingbooleanfalse
errorbooleanfalse
errorMessagestring
to[ "string", "object" ]vue-router's router-link location. If set, renders a router-link component instead of a button element.

Events

EventDescription
click

Style

PropertyTypeDefaultDescription
--button-shapepill, rounded, squaredpill
--button-weightfilled, outlined, textfilled
--button-colorcolorvar(--clr-primary)
--button-color-errorcolorvar(--clr-danger)
--button-color-successcolorvar(--clr-success)
--button-text-colorcolorcomputedEither --clr-primary-text-light or --clr-primary-text-dark, whichever has better contrast with --button-color
--button-sizesmall, normal, large, hugenormal
--tooltip-placementauto, top, right, bottom, leftautoSupports `-start` and `-end` suffix.

Examples

Shape

<bunt-button
>
default
</bunt-button>
--button-shape
:
pill
<bunt-button
>
rounded
</bunt-button>
--button-shape
:
rounded
<bunt-button
>
squared
</bunt-button>
--button-shape
:
squared

Weight

<bunt-button
>
filled
</bunt-button>
--button-weight
:
filled
<bunt-button
>
outlined
</bunt-button>
--button-weight
:
outlined
<bunt-button
>
text
</bunt-button>
--button-weight
:
text

Size

<bunt-button
>
small
</bunt-button>
--button-size
:
small
<bunt-button
>
normal
</bunt-button>
--button-size
:
normal
<bunt-button
>
large
</bunt-button>
--button-size
:
large
<bunt-button
>
huge
</bunt-button>
--button-size
:
huge

Custom Color

<bunt-button
>
color
</bunt-button>
--button-color
:
var(--clr-orange)
<bunt-button
>
color
</bunt-button>
--button-color
:
var(--clr-yellow)
--button-text-color
:
var(--clr-red)

Icon

<bunt-button
icon
="
plus
"
>
with icon
</bunt-button>
<bunt-button
icon
="
space-invaders
"
>
</bunt-button>
<bunt-button
icon
="
space-invaders
"
>
</bunt-button>
--button-shape
:
rounded
<bunt-button
icon
="
space-invaders
"
>
</bunt-button>
--button-shape
:
squared
<bunt-button
icon
="
space-invaders
"
>
</bunt-button>
--button-weight
:
outlined
<bunt-button
icon
="
space-invaders
"
>
</bunt-button>
--button-weight
:
text

Tooltip

<bunt-button
tooltip
="
a tooltip!
"
>
hover me!
</bunt-button>
--tooltip-placement
:
left

States

<bunt-button
:disabled
="
true
"
>
disabled
</bunt-button>
<bunt-button
:loading
="
true
"
>
loading loading
</bunt-button>
<bunt-button
:error
="
true
"
>
error
</bunt-button>
<bunt-button
errorMessage
="
something went wrong!
"
>
error message
</bunt-button>
<bunt-button
to
="
/some-path
"
>
router-link
</bunt-button>

Released under the MIT License.