How to use a Button block
A button highlights a link to the user. A link should be specific, descriptive and front-loaded with relevant terms. Find out how to write an effective and accessible link.
How to use a button
You can link to another page on your site, for example:
You can also link to another website. For accessibility include the name of the site in the link text, for example:
Try to avoid links which go to to a specific part of a page (anchor links) as this breaks accessibility guidelines.
Consider if you need to use a button. A link should be added in context, at the point in the content where it’s useful. Often this will be in the text itself and a button will not be needed.
How to add a Button block
To add a Button block to your page:
- Click the plus (‘+’) button to add a block to your page.
- Type ‘button’.
- Click the ‘Buttons’ option.
- Enter the text for your link in the yellow box.
- Click the button to see its context menu.
- Click the ‘Link’ button.
- Enter the url of the site you want the button to go to and press ‘return’ on your keyboard.
- Click ‘Open in a new tab’ if you want the button to open in a new tab (it will turn blue when selected).
How to change the colour of a button
Available colours for your button are controlled when you set up your site’s colour theme. To select this for your button:
- If you can’t see the right settings sidebar, click the black ‘Settings’ button on the top right toolbar.
- In the right settings sidebar, click the ‘Block’ tab to make sure it’s selected.
- Click the black and white ‘circle’ button to select styles.
- Under ‘Color’ click ‘Background’ to change your button’s background colour.
- Under ‘Color’ click ‘Text’ to change the colour of the button text to white (if the button’s colour makes the text hard to read).
How to change the width of a button
The width of the button changes to fit the size of your link text. You can also change it to be a specific width, up to a maximum width of 800 pixels. This is ‘100%’ of the minimum accessible screen size.
For example, the button below is 100% width:
To change the width of a button:
- If you can’t see the right settings sidebar, click the black ‘Settings’ button on the top right toolbar.
- In the right settings sidebar, click the ‘Block’ tab to make sure it’s selected.
- Under Width settings click ‘25%’, ‘50%’, ‘75%’ or ‘100%’ to change the width of the button (it will turn blue when selected).
- If you want to return to a width based on the button text click the % button again to deselect it.
How to add a button to a banner
You can also add a button in a banner to give it more context and emphasis. The text in this banner can use headings to make it accessible. For example:
Find out what support you might be able to get to help with your living costs. You can get benefits and other financial support if you’re eligible.
To add a banner with a button and text inside it:
- Hover beneath an existing block and click the plus ‘+’ icon to select a block.
- Click ‘Browse all’.
- Click the ‘Patterns’ tab.
- Click ‘Featured’.
- Click the grey box to the right ‘GOV.UK Call-to-action’.
- Click on the page to deselect the patterns option screen.
- Click the text and link to edit them.
A banner is a full-width component and will display incorrectly on desktop screens if you use it on a page with a navigation sidebar. This sidebar appears when you set subpage navigation (hierarchy) on a page. We advise you only use banners on pages without child pages (for example, the home page).