Button (TButton)

VueJs reactive <button /> component with configurable classes, variants, and most common events. Friendly with utility-first frameworks like TailwindCSS..

Playground:


Basic example

<t-button>Example button</t-button>

Props

PropertyTypeDefault valueDescription
value (v-model)[String, Number]nullHTML attribute
idStringundefinedHTML attribute
nameStringundefinedHTML attribute
disabledBooleanundefinedHTML attribute
readonlyBooleanundefinedHTML attribute
autofocusBooleanundefinedHTML attribute
requiredBooleanundefinedHTML attribute
autocompleteStringundefinedHTML attribute
typeStringundefinedHTML attribute
tabindex[String, Number]undefinedHTML attribute
textStringundefinedText of the button (when no slot used)
tagNameString'button'HTML Tag to use for the component button or a
hrefStringnullHref attribute for a
nativeBooleanfalseSet to force to render the default button instead for a router-link, inertia-link, etc
classes[String, Array, Object]'form-radio'The default CSS classes
fixedClasses[String, Array, Object]undefinedFixed CSS classes that will be merged with the active set of classes
variantsObjectundefinedThe different variants of classes the component have
variant[String, Object]undefinedThe variant that will be used

Note: when the href prop is set it changes the tag name to a

VueRouter compatibility

This button is compatible with vue-router, you just need to define the to prop and if the router-link or nuxt-link component is available it will render the component.

When the component is rendered as RouterLink you can use the properties of that component:

PropertyTypeDefault value
to[String, Object]undefined
replaceBooleanfalse
appendBooleanfalse
exactBooleanfalse
activeClassString'router-link-active'
exactActiveClassString'router-link-exact-active'

InertiaJs compatibility

This button is compatible with inertia-link and will be converted if the href prop is set and the InertiaLink component is available.

When the component is rendered as RouterLink you can use the properties of that component:

PropertyTypeDefault value
methodString'get'
dataObject{}
preserveStateBooleanfalse
preserveScrollBooleanfalse
event[String, Array]'click'
onlyArray[]

Events

EventArgumentsDescription
focusFocusEventEmitted when the button is focused
blurFocusEventEmitted when the button is blurred
clickMouseEventEmitted when the button is clicked