Button
When to use a button or a link
Button styling can be applied to either button or link elements. Use the appropriate element for the task: use a button element when the user is performing an action, use a link element when the user is navigating.
Try to limit the use of styling link elements to look like buttons, as this may confuse the visual clues for how that element can be interacted with.
Types of button
Primary button
This is the default button style. Use this for your primary calls to action. Multiple primary buttons can confuse users so try to have only one of these per page (or section of a page).
Cancel button
If a button is used to cancel or back out of an action, this style should be used. This button is typically used alongside a primary button.
Secondary button
All other non-primary actions should use this style. It has less visual prominence than the primary and cancel buttons.
Disabled button
Buttons in a disabled or unclickable state should be visually distinct and use this display.
Disabled buttons can confuse users so only include them if user research shows that they are helpful in your particular use case.
Width variants
Flexible width
This is the default behaviour with buttons expanding to fit the length of text.
Fixed width
Use fixed-width buttons to force uniformity in button widths. Button labels will wrap onto multiple lines if there is insufficient space.
Maximum width
Use maximum-width buttons for large buttons. These will fill the width of small screens, up to a maximum width of 480px.
Size variants
Small buttons
A small button style can be used when available space is limited.
The small button modifier can be applied to any button type or width variant.
Buttons with icons
Icons can be added to buttons. Buttons with icons can also have any size, type or width modifiers applied to them.
The icons can be aligned to either side of the button.
Icon-only buttons
Buttons can contain an icon with no visible text. If you do this, make sure that the intention of the button is clearly communicated in a way that is accessible to users of assistive technology.
Website analytics
To track interactions with button elements in Google Analytics using Google Tag Manager, each button has a data attribute that describes the action.
The data attribute is added automatically by the Design System’s ‘tracking’ script.
Standard links do not receive additional tracking attributes so it is recommended to use the button component when linking to both internal and external service start pages to improve analytics data.
Feedback, help and support
If you need help or support you can e-mail us at designsystem@gov.scot
There is a problem
Thanks for your feedback