Skip to content

Button

Button Props ​

NameTypeDefaultDescription
labelstringrequiredNames the action and becomes visible text when no default slot is present.
variant'primary' | 'secondary' | 'ghost' | 'destructive''secondary'Visual hierarchy and semantic variant.
size'sm' | 'md' | 'lg''md'Button size.
elevation'none' | 'low' | 'med' | 'high''none'Resting shadow depth for a standalone floating button; ButtonGroup owns it inside a group.
type'button' | 'submit' | 'reset''button'Native button type.
namestring—Form submission name.
valuestring | number | readonly string[]—Form submission value.
formstring—ID of the associated form.
isDisabledbooleanfalseDisables interaction. A tooltip switches this to aria-disabled so focus remains available.
isLoadingbooleanfalseShows loading state, sets aria-busy, and disables non-interruptible activation.
isInterruptiblebooleanfalseAllows clickAction to run again while earlier work is pending.
clickAction(event: MouseEvent) => void | Promise<void>—Action function that automatically drives pending state.
isIconOnlybooleanfalseShows only the icon slot and uses label to name the button.
widthnumber | string—Button width. Numbers become pixels; CSS strings are used as supplied.
loadingLabelstring'Loading'Localized text used by the spinner and live region.
tooltipstring—Supplementary hint shown on hover and keyboard focus.
hrefstring—Renders the enabled root as a link when present.
asstring | Component'a'Custom Vue link component for href mode. It receives both href and to.
targetstring—Link browsing context.
relstring—Link relationship attribute.

Async actions ​

  • @click runs before clickAction.
  • If @click calls event.preventDefault(), the component skips clickAction.
  • If clickAction returns a Promise, the component enters the loading state.
  • When the Promise fulfills or rejects, the component clears the loading state.
  • The application must catch errors inside clickAction.

Repeated activation ​

  • If isInterruptible is false, loading blocks another activation.
  • If isInterruptible is true, loading permits another activation.
  • Repeated activation runs multiple actions concurrently.
  • The component does not cancel earlier Promises.

To cancel an earlier network request, call AbortController.abort() in the application.

Button Slots ​

NameDescription
defaultOptional visible-content override. label remains the stable accessible name.
iconDecorative icon before the label.
endShort trailing decoration such as a badge or icon. Ignored in icon-only mode.

Button Events ​

NamePayloadDescription
clickMouseEventCancellable Vue component event. It is not emitted while disabled, non-interruptible loading, or deduplicated.

Template ref ​

Button exposes element. Its type is HTMLButtonElement | HTMLAnchorElement | HTMLElement | null.

Native attributes ​

The root element receives:

  • HTML attributes.
  • aria-* attributes.
  • data-* attributes.
  • class.
  • style.
  • Native event listeners.