Button
VButton triggers an action or navigates to a URL when href is set.
Usage
Examples
Variants and tones
Use variant for the visual style and tone for the action’s intent.
Elevated
elevated adds a shadow. The ghost and outline variants also gain a background.
Sizes
size adjusts the height, padding, text and icons.
Full width
fullWidth makes the button fill its parent’s width.
With icons
Set iconStart or iconEnd to add icons. Use #start or #end for custom content.
Custom icons
Both icon props accept an IconSource: a built-in icon, a name resolved by your application, SVG path data, a component or an image.
Link
href renders a link. Navigation is blocked while the button is disabled or loading.
States
disabled prevents activation. loading also shows a spinner and sets aria-busy.
Router
VButton renders a real <a> when href is set. With Nuxt or Vue Router, render it inside the router link in custom mode and pass on href and navigate. A click with a modifier key still opens a new tab.
<RouterLink v-slot="{ href, navigate }" to="/settings" custom>
<VButton :href="href" @click="navigate">Settings</VButton>
</RouterLink>API
Props
| Prop | Type | Default |
|---|---|---|
variant | ButtonVariant'solid' | 'outline' | 'ghost' | 'soft' | 'solid' |
Visual style: solid for a filled background, soft for a tinted background, outline for a border, or ghost for a transparent background until hover. VButtonGroup overrides this value. | ||
tone | ButtonTone'accent' | 'neutral' | 'danger' | 'accent' |
Action intent: accent for a primary action, neutral for a secondary action, or danger for a destructive action. Inherits from VButtonGroup when omitted; otherwise defaults to accent. | ||
elevated | boolean | false |
Adds a shadow and, for ghost and outline, a background. VButtonGroup overrides this value. | ||
size | ButtonSize'xs' | 'sm' | 'md' | 'lg' | 'xl' | 'md' |
Button size. VButtonGroup overrides this value. | ||
fullWidth | boolean | false |
| Fills the parent’s width. | ||
href | string | none |
Link destination. Renders an <a> instead of a <button>. When disabled or loading, the link loses its destination and cannot receive focus or navigate. | ||
type | ButtonHTMLAttributes['type'] | 'button' |
Native button type. Ignored when href is set. | ||
disabled | boolean | false |
| Prevents activation and removes the button from the tab order. | ||
loading | boolean | false |
Disables the button, sets aria-busy and replaces iconStart or #start content with a spinner. | ||
iconStart | IconSource | none |
Icon before the label. Replaced by the #start slot. | ||
iconEnd | IconSource | none |
Icon after the label. Replaced by the #end slot. | ||
iconFilled | boolean | false |
Requests filled versions of iconStart and iconEnd, where supported. Does not affect slot content. | ||
Slots
| Slot | Type |
|---|---|
default | {} |
| Button label. | |
start | {} |
Content before the label, replacing iconStart. Hidden while loading. Add aria-hidden="true" to decorative content. | |
end | {} |
Content after the label, replacing iconEnd. | |
Types
Types used in the API tables. Import exported types from vectis-ui.
export interface BuiltinIcon {
name: string
paths: readonly [string] | readonly [string, string]
}export type IconRender =
| { path: string; viewBox?: string }
| { component: Component; props?: Record<string, unknown> }
| { src: string }
| { text: string; class?: string }
| { class: string }export type IconSource = string | BuiltinIcon | IconRender