When to use this element
Use a button to help users carry out an action like starting an application or saving their information.
When not to use this element
Buttons shouldn’t be used to move a customer between topics, to send them to a different content page or to link to an external resource.
Button text
Button text should be short and describe the action the button performs.
- ‘Start now’ at the start of the service
- ‘Sign in’ to an account a user has already created
- ‘Continue’ to move to a different concept, see form layout for more information
- ‘Save and continue’ when the service does save a user’s information
- ‘Save and come back later’ when a user can save their information and come back later
- ‘Add another’ to add another item to a list or group
- ‘Pay now’ to make a payment
- ‘Sign out’ when a user is signed in to an account
Buttons on dark backgrounds
Use the .inverted class to show white buttons on dark backgrounds — for example, in headers, custom components, and patterns with darker backgrounds.
Make sure all users can see the button — the white button and background colour must have a contrast ratio of at least 3:1.
.inverted {
background: transparent;
border: 2px solid #fff;
box-shadow: none;
color: #fff;
}
Button alignment
Use a button group when two or more buttons are placed together.
Any links within a button group should align with the centre of the buttons.
Interaction states
All buttons should have effect states for hover, focus and active. State changes give the customer reassurance they can interact with the element and help understand what to expect while interacting with the component.
::hover {
background: #005A30;
}
::focus {
border-color: #f5CE3E;
outline: 3px solid transparent;
-webkit-box-shadow: inset 0 0 0 2px #f5CE3E;
box-shadow: inset 0 0 0 2px #f5CE3E;
}
::focus:not(:active):not(:hover) {
border-color: #f5CE3E;
color: #000;
background-color: #f5CE3E;
-webkit-box-shadow: 0 3px 0 #000;
box-shadow: 0 3px 0 #000;
&::after {
background-color: #000;
}
}