Vue playground

Nova v3.37.0

Preview

Vue

Button

nv-button

Triggers an action and visually communicates interactivity and importance.

Live demo

Emphasis
Size

Use a button for an action on the current page, such as saving, sending or opening a dialog.

Anatomy

A button labelled Button, with a people icon before the label and an arrow after it. Callouts 1, 2 and 3 mark the leading icon, label and trailing icon.

The three parts of a button.
  1. Leading icon (optional) reinforces the action.
  2. Label names the action.
  3. Trailing icon (optional) shows direction or outcome.

States and themes

Buttons provide default, hover, keyboard-focus, pressed and disabled styles in Spark and Ocean. Keep a visible focus indicator so keyboard users can locate the current action. The active prop represents a lasting active selection or current page; the pressed style appears during activation.

The design state list includes read-only, but nv-button has no read-only prop. Use disabled when the action is unavailable and explain why nearby.

Emphasis and size

Four emphasis levels, high, medium, low and lower, set the hierarchy between actions. Give the main action the most emphasis, and avoid placing high-emphasis buttons next to each other. Mark actions that cannot be undone, such as deleting, with danger; it works with every emphasis level.

high
medium
low
lower

Sizes xs, sm, md (default) and lg match the density of the layout and the touch target you need.

xs
sm
md · default
lg

Loading and disabled

Set loading while an action runs: a spinner appears and the button is disabled until it finishes. Disable an action that is unavailable, and explain why next to it. Buttons have no read-only state.

loading
disabled

Icons and accessibility

Use the leading-icon and trailing-icon slots for symbols that reinforce the label. The label should still explain the action without the icons. Mark purely decorative icons with aria-hidden="true".

Enter and Space activate a focused button. Use type="submit" for submitting a form; the default type="button" performs an ordinary action. Danger is a separate danger flag that works with all four emphasis levels, rather than an emphasis="danger" value.

Writing labels

DoStart with a verb, use three words or fewer, and be specific.
Don'tLeave out periods, “please” and “click here”.

Sources