WlButton

Action button with variants, sizes and loading state.
Components / Actions v0.1.0
On this page

Variant and tone

Variant sets the button’s appearance. Tone sets its color. Choose Auto to use the color associated with the variant.

variant
tone

Clicks: 0

Full example
<WlButton variant="primary" @click="count++">
  Add
</WlButton>
Compare variants and tones

Size and density

Compare the four sizes from xs to lg. Compact density reduces the height within each size.

size
density

Clicks: 0

Full example
<WlButton size="md" density="default" @click="count++">
  Add
</WlButton>
Compare all four sizes

Loading and disabled

Turn on loading to see the spinner. Both loading and disabled prevent another click.

Clicks: 0

Full example
<WlButton @click="count++">
  Add
</WlButton>
Try saving, cancelling and retrying

Icon position

Pass an icon into the icon slot. Use start to place it before the label or end to place it after.

iconPosition

Clicks: 0

Full example
<WlButton icon-position="start" @click="count++">
  <template #icon>
    <WlIcon name="arrow-right" :size="16" />
  </template>
  Continue
</WlButton>
Explore other slot examples

Buttons in forms

A submit button submits the form. A reset button resets it. Try both and watch the submission count. Turn on block to fill the available width.

type

Submissions: 0

Full example
<WlButton as="button" type="submit">
  Apply
</WlButton>
Open the form with field validation

When to use

  • primary is the group's primary action; secondary is secondary.
  • ghost and link are less prominent actions; tone="danger" marks actions that may delete data.
  • block fills the available width; size and density change dimensions and spacing while preserving the DOM contract.

To use the button as a link, pass a URL with href.