Skip to content

Button

A clickable action. Eight hues, five sizes, ghost and danger modes, optional loading and icon.

Basic usage

Example

Hues

Sizes

States

Pass an href to render an <a> styled like a button.

Example

Accessibility

  • Always has a <button> (or <a> if href) — never a <div>.
  • aria-busy is set during loading.
  • disabled removes from the tab order and prevents click handlers.

API

Props

NameTypeDefaultDescription
labelstringundefinedVisible label. Override with the default slot for richer content.
hueEpHue"primary"Semantic hue.
sizeEpSizeundefinedSize. Falls back to `<EpConfigProvider size>`, then `"md"`.
ghostbooleanfalseGhost / outline style.
dangerbooleanfalseForce the destructive (error) palette regardless of `hue`.
blockbooleanfalseRender full-width.
loadingbooleanfalseShow a spinner and ignore clicks.
disabledbooleanfalseDisable interaction.
htmlTypeunion"button"`<button>` `type` attribute. Ignored when `href` is set.
hrefstringundefinedWhen set, the component renders as an `<a>` instead of a `<button>`.
targetunionundefinedAnchor target. Auto-applies `rel="noopener noreferrer"` for `_blank`.
iconstringundefinedIcon name (resolved by `SVGIcon`). Prefer the `#icon` slot.
iconPositionEpPosition"after"Position of the icon relative to the label.

Events

EventPayloadDescription
click{"names":["MouseEvent"]}

Slots

SlotScopeDescription
icon
default

Released under the MIT License. Built with VitePress.