Example
By combining different classes, the different buttons are formed. Apart from a few exceptions, almost all buttons in wescale can be represented with the five different buttons from the above example. Storybook: Buttons
Button types
Primary button
Primary buttons always trigger affirmative actions. They have a lot of visual weight and therefore receive a lot of attention. To help users complete their tasks, we use primary buttons to guide them through the various steps to their goals. To support this, it is important to use as few primary buttons as possible in each context.
<wui-button variant="primary">Primary button</wui-button>
Secondary button
From a visual point of view, the secondary button has a slightly lower weight than the primary button. Also from the user progress point of view, it calls actions that are not essential to complete a task but are nevertheless helpful and important when working on a task.
<wui-button variant="primary" :outline="true">Secondary button</wui-button>
Default button
As the name already suggests, default buttons are used for actions which are neither a primary nor a secondary. There can be contexts without default buttons, and there can be a lot of them calling similar actions.
<wui-button variant="default">Default button</wui-button>
Link button
Link buttons have the lowest visual weight. They provide the user with additional information and actions but they don't distract from the main tasks of the user. In many cases link buttons lead to another site. Actions like "Back" or "Cancel" are always a link button.
<wui-button variant="link">A link button</wui-button>
Icon button
There are two main reasons for using an icon button:
- There is not enough space to use a text button.
- Reduce the visual noise when there are to many buttons which can't be relocated somewhere else on the site. This applies in particular for the header where icon buttons are frequently used in form of a button-group.
Icons are challenging to understand, and oftentimes different users have different understandings of what the same icon might mean. That is why every Icon button should have a precise title attribute and a tooltip to describe the action. Make sure that the same icons are always used for the same actions across the platform. Storybook: Tooltips
<div>
<wui-button
v-w-tooltip.hover
title="Don't forget me, the tooltip ;)"
variant="default"
:outline="true"
>
<i class="fa-solid fa-font-awesome"></i>
</wui-button>
</div>
Ghost button
The ghost modifier reduces a button to a mere shadow of itself - a ghost. Ghost buttons are (of course) only visible when the background is colored/dark.
<div class="wui-bg-color--gray-33 text--center p-15 position--relative">
<button class="wui-btn wui-btn--ghost m-y-30">A ghost button</button>
<i class="fal fa-ghost text--white position--absolute position--right position--bottom p-10 font-size--3xl"></i>
</div>
Split button
There are primary, secondary and default split buttons which should be used according to their level of importance.
Storybook: Split buttons
<div>
<wui-dropdown variant="primary" split text="Option 1" class="m-10">
<wui-dropdown-item href="#">Option 2</wui-dropdown-item>
<wui-dropdown-item href="#">Option 3</wui-dropdown-item>
<wui-dropdown-item href="#">Option 4</wui-dropdown-item>
</wui-dropdown>
</div>
Small buttons
Buttons of type wui-btn--sm
are used rather rarely. A case where we use this variant is e.g. a table within a widget. Here, quite a few buttons are very close to each other and thus create a high visual weight. Since this high visual weight does not necessarily correspond to the importance of the user tasks, we use a small button.
<div class="display--flex justify-content-around">
<wui-button variant="primary" size="sm">Primary button small</wui-button>
<wui-button variant="primary" :outline="true" size="sm">Secondary button small</wui-button>
<wui-button variant="default" size="sm">Default button small</wui-button>
</div>
Dismissive buttons
Dismissive buttons play a very important rule for the user experience because these are the buttons that can really hurt users working on their tasks. It should always signal its destructive action to prevent the user from accidentally selecting a dismissive button. In places where the user might lose a lot of data, there is a confirmation modal to reconfirm the destructive action.
<div class="display--flex justify-content-around">
<wui-button v-w-tooltip.hover title="Delete item XYZ" variant="default" :outline="true"><i class="fa-solid fa-trash"></i></wui-button>
<wui-button variant="danger">Delete</wui-button>
</div>
Buttons in the wild
Buttons in scene header

- Cancel is always a
.wui-btn--link
- In the scene header, we use an icon button for deleting an item (FA-icon:
.fa-solid .fa-trash
). Clicking the button triggers a confirmation modal in which the primary button is of typedanger
. - See also Wording
Buttons in a destructive confirmation modal

Button order
If there is more than one button the order of the buttons is increasing from left to right according to the hierarch level (level of importance).
<div class="clearfix">
<div class="wui-inline-list pull-right">
<div class="wui-inline-list__item"><wui-button variant="link">A link button</wui-button></div>
<div class="wui-inline-list__item"><wui-button variant="default">Default button</wui-button></div>
<div class="wui-inline-list__item"><wui-button variant="primary" :outline="true">Secondary button</wui-button></div>
<div class="wui-inline-list__item"><wui-button variant="primary">Primary button</wui-button></div>
</div>
</div>
Wording
The naming of buttons depends on the particular process and contains the entity's name. When a new item is created, the wording changes depending on the next possible step of the user.
- The button for creating a new and blank entity, primarily used in the management UI, is called New [entity].
- If the entity has not been saved yet, the button is called Create [entity].
- If the entity has already been saved, the button is called Update [entity].
Do: New creditor, Create creditor, Update creditor Don't: Create a new creditor
When labeling buttons, we also pay attention to the correct pluralization in the respective language.
Do: No item | 1 item | {n} items
Style guide: Numbers / pluralization
WUI decisions 
- Consistency. Use the given wui-buttons. Do not build your own.
- Hierarchy. Always pay attention to the visual weight of each button. Also in combination with other buttons.
- Order. Acoording to their importance from left to right.
- Wording. Use clear and distinct labels. Buttons do not have articles ("a", "an", or "the"). We use significant verbs whenever possible and avoid generic words like "Yes" or "OK".
- Customizable. The color of some buttons will vary according to the customers CI.
- Split-Buttons. The label of the main button may not be found in the dropdown list again.
- Back and Cancel. Actions like "Back" or "Cancel" are always a link button in wescale.
- Confiramtion modal. In a confirmation modal for a destructive action, the primary button is always of the variant 'danger'.
- Table-buttons. In tables, the buttons are displayed on hover. This way, we can reduce the visual noise of the page and make the user aware of the possible actions at the right moment.
import { WuiButton } from "@wui/wui-vue/lib/button";
Description
Use WUI's custom
wui-button
component for actions in forms, dialogs, and more. Includes support for a handful of contextual variations, sizes, states, and more.
Overview
WuiVue's <wui-button>
component generates either a <button>
element, <a>
element, or <router-link>
component with the styling of a button.
<div>
<wui-button>Button</wui-button>
<wui-button variant="danger">Button</wui-button>
<wui-button variant="success">Button</wui-button>
<wui-button variant="primary" :outline="true">Button</wui-button>
</div>
<!-- wui-button.vue -->
Element type
The <wui-button>
component generally renders a <button>
element. However, you can also render an <a>
element by providing an href
prop value. You may also generate vue-router
<router-link>
when providing a value for the to
prop (vue-router
is required).
<div>
<wui-button>I am a Button</wui-button>
<wui-button href="#">I am a Link</wui-button>
</div>
<!-- wui-button-types.vue -->
Type
You can specify the button's type by setting the prop type
to 'button'
, 'submit'
or 'reset'
. The default type is 'button'
.
Note the type
prop has no effect when either href
or to
props are set.
Sizing
Fancy larger or smaller buttons? Specify lg
or sm
via the size
prop.
<wui-row>
<wui-col lg="4" class="p-b-15"
><wui-button size="sm">Small Button</wui-button></wui-col
>
<wui-col lg="4" class="p-b-15"
><wui-button>Default Button</wui-button></wui-col
>
<wui-col lg="4" class="p-b-15"
><wui-button size="lg">Large Button</wui-button></wui-col
>
</wui-row>
<!-- wui-button-sizes.vue -->
Contextual variants
Use the variant
prop to generate the various WUI contextual button variants.
By default <wui-button>
will render with the secondary
variant.
Solid color variants
default
, primary
, secondary
, success
, danger
, warning
, info
, light
and dark
.
<div>
<wui-button variant="default">Default</wui-button>
<wui-button variant="primary">Primary</wui-button>
<wui-button variant="secondary">Secondary</wui-button>
<wui-button variant="success">Success</wui-button>
<wui-button variant="danger">Danger</wui-button>
<wui-button variant="warning">Warning</wui-button>
<wui-button variant="info">Info</wui-button>
<wui-button variant="light">Light</wui-button>
<wui-button variant="dark">Dark</wui-button>
</div>
<!-- wui-button-solid.vue -->
Outline color variants
In need of a button, but not the hefty background colors they bring? Use the outline
prop to remove all background images and colors on any <wui-button>
:
<div>
<wui-button variant="default" :outline="true">Default</wui-button>
<wui-button variant="primary" :outline="true">Primary</wui-button>
<wui-button variant="secondary" :outline="true">Secondary</wui-button>
<wui-button variant="success" :outline="true">Success</wui-button>
<wui-button variant="danger" :outline="true">Danger</wui-button>
<wui-button variant="warning" :outline="true">Warning</wui-button>
<wui-button variant="info" :outline="true">Info</wui-button>
<wui-button variant="light" :outline="true">Light</wui-button>
<wui-button variant="dark" :outline="true">Dark</wui-button>
</div>
<!-- wui-button-outline.vue -->
Link variant
Variant link
will render a button with the appearance of a link while maintaining the default padding and size of a button.
<div>
<wui-button variant="link">Link</wui-button>
</div>
<!-- wui-button-link.vue -->
Tip: remove the hover underline from a link variant button by adding the WUI utility class text-decoration-none
to <wui-button>
.
Block level buttons
Create block level buttons — those that span the full width of a parent — by setting the block
prop.
<div>
<wui-button block variant="primary">Block Level Button</wui-button>
</div>
<!-- wui-button-block.vue -->
Disabled state
Set the disabled
prop to disable button default functionality. disabled
also works with buttons rendered as <a>
elements and <router-link>
(i.e. with the href
or to
prop set).
<div>
<wui-button disabled size="lg" variant="primary">Disabled</wui-button>
<wui-button disabled size="lg">Also Disabled</wui-button>
</div>
<!-- wui-button-disabled.vue -->
Pressed state and toggling
Buttons will appear pressed (with a darker background, darker border, and inset shadow) when the prop pressed
is set to true
.
The pressed
prop can be set to one of three values:
true
: Sets the.active
class and adds the attributearia-pressed="true"
.false
: Clears the.active
class and adds the attributearia-pressed="false"
.null
: (default) Neither the class.active
nor the attributearia-pressed
will be set.
To create a button that can be toggled between active and non-active states, use the .sync
prop modifier (available in Vue 2.3+) on the pressed
property
<template>
<div>
<h5>Pressed and un-pressed state</h5>
<wui-button :pressed="true" variant="success">Always Pressed</wui-button>
<wui-button :pressed="false" variant="success">Not Pressed</wui-button>
<h5 class="m-t-20">Toggleable Button</h5>
<wui-button :pressed.sync="myToggle" variant="primary"
>Toggle Me</wui-button
>
<!-- TODO -->
<p>Pressed State: <strong>{ myToggle }</strong></p>
<h5>In a button group</h5>
<wui-button-group size="sm">
<wui-button
v-for="(btn, idx) in buttons"
:key="idx"
:pressed.sync="btn.state"
variant="primary"
>
{ btn.caption }
</wui-button>
</wui-button-group>
<p>Pressed States: <strong>{ btnStates }</strong></p>
</div>
</template>
<script>
export default {
data() {
return {
myToggle: false,
buttons: [
{ caption: "Toggle 1", state: true },
{ caption: "Toggle 2", state: false },
{ caption: "Toggle 3", state: true },
{ caption: "Toggle 4", state: false },
],
};
},
computed: {
btnStates() {
return this.buttons.map((btn) => btn.state);
},
},
};
</script>
<!-- wui-button-toggles.vue -->
If using toggle button style for a radio or checkbox style interface, it is best to use the built-in button
style support of <wui-form-radio-group>
and <wui-form-checkbox-group>
.
Router link support
Refer to the Router support
reference docs for the various supported <router-link>
related props.
Accessibility
When the href
prop is set to '#'
, <wui-button>
will render a link (<a>
) element with attribute role="button"
set and appropriate keydown listeners (Enter and Space) so that the link acts like a native HTML <button>
for screen reader and keyboard-only users. When disabled, the aria-disabled="true"
attribute will be set on the <a>
element.
When the href
is set to any other value (or the to
prop is used), role="button"
will not be added, nor will the keyboard event listeners be enabled.
See also
Component reference
<wui-button>
Component aliases
<wui-button>
can also be used via the following aliases:
<wui-btn>
Note: component aliases are only available when importing all of WuiVue or using the component group plugin.
Properties
Property | Type | Default | Description |
---|---|---|---|
active | Boolean | false | When set to true , places the component in the active state with active styling |
active-class | String | <router-link> prop: Configure the active CSS class applied when the link is active. Typically you will want to set this to class name 'active' | |
append | Boolean | false | <router-link> prop: Setting append prop always appends the relative path to the current path |
block | Boolean | false | Renders a 100% width button (expands to the width of its parent container) |
disabled | Boolean | false | When set to true , disables the component's functionality and places it in a disabled state |
exact | Boolean | false | <router-link> prop: The default active class matching behavior is inclusive match. Setting this prop forces the mode to exactly match the route |
exact-active-class | String | <router-link> prop: Configure the active CSS class applied when the link is active with exact match. Typically you will want to set this to class name 'active' | |
href | String | <b-link> prop: Denotes the target URL of the link for standard a links | |
no-prefetch | Boolean | false | <nuxt-link> prop: To improve the responsiveness of your Nuxt.js applications, when the link will be displayed within the viewport, Nuxt.js will automatically prefetch the code splitted page. Setting no-prefetch will disabled this feature for the specific link |
pill Future release | Boolean | false | Renders the button with the pill style appearance when set to 'true' |
prefetch | Boolean | null | <nuxt-link> prop: To improve the responsiveness of your Nuxt.js applications, when the link will be displayed within the viewport, Nuxt.js will automatically prefetch the code splitted page. Setting prefetch to true or false will overwrite the default value of router.prefetchLinks |
pressed | Boolean | null | When set to 'true', gives the button the appearance of being pressed and adds attribute 'aria-pressed="true"'. When set to false adds attribute 'aria-pressed="false"'. Tri-state prop. Syncable with the .sync modifier |
rel | String | null | <b-link> prop: Sets the rel attribute on the rendered link |
replace | Boolean | false | <router-link> prop: Setting the replace prop will call router.replace() instead of router.push() when clicked, so the navigation will not leave a history record |
router-component-name | String | <b-link> prop: WuiVue auto detects between <router-link> and <nuxt-link> . In cases where you want to use a 3rd party link component based on <router-link> , set this prop to the component name. e.g. set it to 'g-link' if you are using Gridsome (note only <router-link> specific props are passed to the component) | |
size | String | Set the size of the component's appearance. 'sm', 'md' (default), or 'lg' | |
squared Future release | Boolean | false | Renders the button with non-rounded corners when set to 'true' |
tag | String | 'button' | Specify the HTML tag to render instead of the default tag |
target | String | '_self' | <b-link> prop: Sets the target attribute on the rendered link |
to | Object or String | <router-link> prop: Denotes the target route of the link. When clicked, the value of the to prop will be passed to router.push() internally, so the value can be either a string or a Location descriptor object | |
type | String | 'button' | The value to set the button's 'type' attribute to. Can be one of 'button', 'submit', or 'reset' |
variant | String | 'secondary' | Applies one of the WUI theme color variants to the component |
Slots
Name | Description |
---|---|
default | Content to place in the button |
Events
Event | Arguments | Description |
---|---|---|
click | Native click event object | Emitted when non-disabled button clicked |
<wui-button-close>
Component aliases
<wui-button>
can also be used via the following aliases:
<wui-btn-close>
Note: component aliases are only available when importing all of WuiVue or using the component group plugin.
Properties
Property | Type | Default | Description |
---|---|---|---|
aria-label | String | 'Close' | Sets the value of 'aria-label' attribute on the rendered element |
content | String | '×' | The content of the close button |
disabled | Boolean | false | When set to true , disables the component's functionality and places it in a disabled state |
text-variant | String | Applies one of the WUI theme color variants to the text |
Slots
Name | Description |
---|---|
default | Content to place in the button. Overrides the content prop |
Events
Event | Arguments | Description |
---|---|---|
click | Native click event object | Emitted when non-disabled button clicked |
Importing individual components
You can import individual components into your project via the following named exports:
Component | Named Export |
---|---|
<wui-button> | WuiButton |
<wui-button-close> | WuiButtonClose |
Example
import { WuiButton } from "@wui/wui-vue/lib/button";
Vue.component("wui-button", WuiButton);
Importing as a Vue.js plugin
This plugin includes all of the above listed individual components. Plugins also include any component aliases.
Named Export | Import Path |
---|---|
ButtonPlugin | wui/wui-vue/lib/button |
Example
import { ButtonPlugin } from "@wui/wui-vue/lib/button";
Vue.use(ButtonPlugin);