Skip to content

Button

Polymorphic button component that renders as <button>, <a>, or <router-link>. Supports color palettes, render variants, sizes, icons, and loading states.

Import

typescript
import { Button } from 'vuiii'

Basic Usage

vue
import { Button } from 'vuiii'

<Button label="Click me" />
<Button color="primary" label="Submit" />
<Button color="danger" label="Delete" />

Props

PropTypeDefaultDescription
labelstring-Button text content
color'primary' | 'secondary' | 'success' | 'danger' | 'accent''secondary'Color palette
variant'filled' | 'outlined' | 'text''filled'Render style
size'small' | 'normal' | 'large''normal'Button size
prefixIconstring-Icon name to show before label
suffixIconstring-Icon name to show after label
loadingbooleanfalseShows spinner and disables button
disabledbooleanfalseDisables the button
blockbooleanfalseFull width button
pillbooleanfalseRounded pill shape
type'button' | 'submit' | 'reset''button'Native button type
toRouteLocationRaw-Vue Router link (renders as router-link)
hrefstring-External URL (renders as anchor)

Color vs variant

color picks the palette, variant decides how it is drawn — filled (solid background), outlined (transparent with a colored border) or text (no background or border). accent defaults to the primary color and is meant for selection-style emphasis.

Slots

SlotDescription
defaultButton label content (alternative to label prop)
prefixCustom prefix content (replaces prefixIcon)
suffixCustom suffix content (replaces suffixIcon)

Events

The Button forwards native events (click, etc.) to the rendered element (<button>, <a>, or <router-link>). It emits no custom events.

More Examples

Colors

vue
<Button color="primary" label="Primary" />
<Button color="secondary" label="Secondary" />
<Button color="success" label="Success" />
<Button color="danger" label="Danger" />

Variants

vue
<Button color="primary" variant="filled" label="Filled" />
<Button color="primary" variant="outlined" label="Outlined" />
<Button color="primary" variant="text" label="Text" />

With Icons

vue
<Button prefixIcon="plus" label="Add Item" />
<Button label="Download" suffixIcon="arrow-down" />
<Button prefixIcon="save" suffixIcon="chevron-down" label="Save" />

Different Sizes

vue
<Button size="small" label="Small" />
<Button size="normal" label="Normal" />
<Button size="large" label="Large" />
Go HomeAbout
vue
<Button :to="{ name: 'home' }" label="Go Home" />
<Button :to="'/about'" label="About" color="secondary" />

Storybook

For interactive examples with all colors and variants, see Button in Storybook.

Released under the MIT License.