Breaking Changes: This page contains breaking changes. Please read the change log carefully.
Buttons
A button is designed to grab the user’s attention.
Use the button classes on an <a>, <button>, or <input> element. Also you can use any of the available button classes to quickly create a styled button: .btn-default or .btn-primary or even to large version of it: .btn-lg
Design
Use any of the available button classes to quickly create a styled button. On this page you can find multiple types of buttons and the class you need to use for each option:
Add .btn for default buttons and .btn-primary for primary style. Also you can add .btn-destructive class to a default or primary button to transform it from a confirmatory to a destructive button.
Use the primary button to:
Highlight the primary action in the screen, which shall be the main and/or finalising action
Emphasise either normal buttons, menu buttons or split buttons
Use the destructive button to:
Nullify/delete an action/process
It is not a validation state (has-error state) or cancel
Add .btn-squerkle class together with .btn class to have a button like the ones from below. To change the background color you can use or background color helper classes and also to change the size you can do that by changing the padding using the helper classes for paddings. Check out the examples below and the code snippets.
** We recommend you to use this buttons on: 48px x 48px, 32px x 32px and 24px x 24px.
Link buttons (with and without icons) and icon buttons
You can also use .btn-link and .btn-icon. Both will have the height of a default button but won't have the button styling.
Checkout the examples below.
<pclass="mb-4"><b>Normal</b></p><buttontype="button"class="btn btn-icon btn-solid"><spanaria-hidden="true"class="spirisicon spirisicon-sm spirisicon-edit"></span><spanclass="sr-only">Small/default icon button with edit icon and solid background</span></button><buttontype="button"class="btn btn-lg btn-icon btn-solid mr-24"><spanaria-hidden="true"class="spirisicon spirisicon-edit"></span><spanclass="sr-only">Large icon button with edit icon and solid background</span></button><pclass="mt-24 mb-4"><b>:hover</b></p><buttontype="button"class="btn btn-icon btn-solid hover"><spanaria-hidden="true"class="spirisicon spirisicon-sm spirisicon-edit"></span><spanclass="sr-only">Small/default icon button with edit icon and solid background on hover state</span></button><buttontype="button"class="btn btn-lg btn-icon btn-solid hover mr-24"><spanaria-hidden="true"class="spirisicon spirisicon-edit"></span><spanclass="sr-only">Large icon button with edit icon and solid background on hover state</span></button><pclass="mt-24 mb-4"><b>:focus</b></p><buttontype="button"class="btn btn-icon btn-solid focus"><spanaria-hidden="true"class="spirisicon spirisicon-sm spirisicon-edit"></span><spanclass="sr-only">Small/default icon button with edit icon and solid background on focus state</span></button><buttontype="button"class="btn btn-lg btn-icon btn-solid focus mr-24"><spanaria-hidden="true"class="spirisicon spirisicon-edit"></span><spanclass="sr-only">Large icon button with edit icon and solid background on focus state</span></button><pclass="mt-24 mb-4"><b>:active / Pressed</b></p><buttontype="button"class="btn btn-icon btn-solid pressed"><spanaria-hidden="true"class="spirisicon spirisicon-sm spirisicon-edit"></span><spanclass="sr-only">Small/default icon button with edit icon and solid background on pressed state</span></button><buttontype="button"class="btn btn-lg btn-icon btn-solid pressed mr-24"><spanaria-hidden="true"class="spirisicon spirisicon-edit"></span><spanclass="sr-only">Large icon button with edit icon and solid background on pressed state</span></button><pclass="mt-24 mb-4"><b>:disabled</b></p><buttontype="button"class="btn btn-icon btn-solid disabled"tabindex="-1"aria-disabled="true"><spanaria-hidden="true"class="spirisicon spirisicon-sm spirisicon-edit"></span><spanclass="sr-only">Small/default icon button with edit icon and solid background on disabled state</span></button><buttontype="button"class="btn btn-lg btn-icon btn-solid disabled mr-24"tabindex="-1"aria-disabled="true"><spanaria-hidden="true"class="spirisicon spirisicon-edit"></span><spanclass="sr-only">Large icon button with edit icon and solid background on disabled state</span></button>
Buttons with transparent background on normal state
You can use .btn-link with .btn-default or .btn-destructive class for having a button link design to have the interaction style of a default or destuctive button.
<!-- Default login button - .btn-login --><pclass="font-weight-bold mb-8">Default login button <code>.btn-login</code></p><divclass="col-5 p-0"><buttontype="submit"class="btn btn-primary btn-lg btn-login">Sign in</button></div><!-- removed since we do not have Google not Visma icons in Spiris design system --><!-- Secondary login button - .btn-login-secondary --><!-- <p class="font-weight-bold mb-8 mt-40">Secondary login buttons <code>.btn-login-secondary</code></p>
<div class="d-flex flex-column gap-8 col-5 p-0">
<a href="#!" class="btn btn-login-secondary" id="google_signin">
<span class="vismaicon vismaicon-google vismaicon-sm mr-8"></span>Sign in with Google
</a>
<a href="#!" class="btn btn-login-secondary" id="visma_signin">
<span class="vismaicon vismaicon-visma vismaicon-sm mr-8"></span>Sign in with Visma Connect
</a>
</div> -->
States
Below you can find each type of button (default and primary) and how it should look for each state (normal, hover, pressed, active/selected and disabled).
For active/selected state you need to add .active class on the element and include the aria-selected="true" attribute to indicate the state of the element to assistive technologies.
For disabled state (buttons are unclickable) add .disabled class on your button or add the disabled attribute to <button> or <input> buttons. <a> tag don't support the disabled attribute, so you must add the .disabled class to make it visually appear disabled. For disabled buttons, that include .disabled class and <a> tag, they should include the aria-disabled="true" attribute to indicate the state of the element to assistive technologies.