### Example Button Component (HTML and Nunjucks) Source: https://github.com/alphagov/govuk-design-system/blob/main/src/get-started/production/index.md Demonstrates how to use the GOV.UK button component. Provides both HTML and Nunjucks macro examples for integration into your project. Ensure GOV.UK Frontend is installed and configured. ```html Start now ``` ```njk {% from "govuk/components/button/macro.njk" import govukButton %} {{ govukButton({ text: "Start now", href: "#", id: "default-button", classes: "govuk-button--start", attributes: { "draggable": "false" } }) }} ``` -------------------------------- ### Start Button Example Source: https://github.com/alphagov/govuk-design-system/blob/main/src/components/button/index.md Use a start button for the main call to action on a service’s Start page. These typically use a link tag instead of a button tag as they do not usually submit form data. ```html Start now ``` ```nunjucks {% from "govuk-prototype-components/lib/macro.njk" import govukButton %} {{ govukButton({ text: 'Start now', isStartButton: true }) }} ``` -------------------------------- ### Install npm Dependencies Source: https://github.com/alphagov/govuk-design-system/blob/main/README.md Run this command after cloning the repository to install all necessary Node.js packages for the project. ```shell npm install ``` -------------------------------- ### All Tag Colours Example Source: https://github.com/alphagov/govuk-design-system/blob/main/src/components/tag/index.md Provides an example of all available tag colours, including additional options beyond the standard ones. This example uses HTML and Nunjucks. ```html Default Blue Green Pink Red Yellow Turquoise Grey ``` ```nunjucks {% from "govuk/components/tag/macro.njk" import govukTag %} {{ govukTag({ text: "Default" }) }} {{ govukTag({ text: "Blue", classes: "govuk-tag--blue" }) }} {{ govukTag({ text: "Green", classes: "govuk-tag--green" }) }} {{ govukTag({ text: "Pink", classes: "govuk-tag--pink" }) }} {{ govukTag({ text: "Red", classes: "govuk-tag--red" }) }} {{ govukTag({ text: "Yellow", classes: "govuk-tag--yellow" }) }} {{ govukTag({ text: "Turquoise", classes: "govuk-tag--turquoise" }) }} {{ govukTag({ text: "Grey", classes: "govuk-tag--grey" }) }} ``` -------------------------------- ### Beta phase banner example Source: https://github.com/alphagov/govuk-design-system/blob/main/src/components/phase-banner/index.md Use this example to indicate that the service is in its beta phase. It can be rendered using HTML or Nunjucks. ```html

This service is in beta. Your feedback will help us to improve it.

``` ```nunjucks {% from "govuk-frontend/components/phase-banner/macro.njk" import govukPhaseBanner %} {{ govukPhaseBanner({ "classes": "govuk-phase-banner--beta", "html": "This service is in beta. Your feedback will help us to improve it." }) }} ``` -------------------------------- ### Confirm a phone number example Source: https://github.com/alphagov/govuk-design-system/blob/main/src/patterns/confirm-a-phone-number/index.md This example demonstrates the default implementation of the 'confirm a phone number' pattern. It requires the 'example' macro from '_example.njk' and the 'govukInsetText' macro from 'govuk/components/inset-text/macro.njk'. ```html
We sent it to 07700 900 955
``` ```nunjucks {% from "_example.njk" import example %} {{ example({ group: "patterns", item: "confirm-a-phone-number", example: "default", html: true, nunjucks: true, open: false, loading: "eager" }) }} ``` -------------------------------- ### Default select example Source: https://github.com/alphagov/govuk-design-system/blob/main/src/components/select/index.md This is a basic example of the select component. It can be rendered using HTML or Nunjucks. ```html
``` ```nunjucks {% from "govuk/components/select/macro.njk" import govukSelect %} {{ govukSelect({ label: { text: "Nationalities" }, id: "select-1", name: "select-1", items: [ { value: "", text: "Please select a nationality", selected: true, disabled: true }, { value: "afghan", text: "Afghan" }, { value: "albanian", text: "Albanian" } ] }) }} ``` -------------------------------- ### Contact a department or service team - Default example Source: https://github.com/alphagov/govuk-design-system/blob/main/src/patterns/contact-a-department-or-service-team/index.md Basic example of how to display contact information for a department or service team. ```html

Contact the team

You can contact the team by:

``` -------------------------------- ### Default task list example Source: https://github.com/alphagov/govuk-design-system/blob/main/src/components/task-list/index.md Use this example to display a default task list. It includes tasks with names and statuses. ```html
  1. 1. What is this section about?

  2. 2. What is this section about?

``` -------------------------------- ### Example Question Page Component Source: https://github.com/alphagov/govuk-design-system/blob/main/src/patterns/question-pages/index.md This Nunjucks macro renders a default question page example. It's used to include interactive examples within the documentation. ```nunjucks {{ example({ group: "patterns", item: "question-pages", example: "default", html: true, nunjucks: true, open: false, loading: "eager" }) }} ``` -------------------------------- ### Radio items with hints example Source: https://github.com/alphagov/govuk-design-system/blob/main/src/components/radios/index.md This example demonstrates how to add hints to radio items to provide additional information. It includes HTML and Nunjucks versions. ```html
You will not need to pay for this service
There will be a charge of £10.50 to arrange a collection
``` ```nunjucks {% from "govuk-frontend/components/radios/macro.njk" import radios %} {{ radios({ idPrefix: "waste-agreed", name: "waste-agreed", items: [ { value: "yes", text: "Yes", checked: true, hint: { text: "You will not need to pay for this service" } }, { value: "no", text: "No", hint: { text: "There will be a charge of £10.50 to arrange a collection" } } ] }) }} ``` -------------------------------- ### Details component - Second example HTML Source: https://github.com/alphagov/govuk-design-system/blob/main/src/components/details/index.md This HTML example demonstrates a details component with a different summary text. It is initially closed. ```html
Second example

Content for the second example.

``` -------------------------------- ### Default Tabs Example Source: https://github.com/alphagov/govuk-design-system/blob/main/src/components/tabs/index.md This example shows the default implementation of the tabs component, including both HTML and Nunjucks versions. ```html

Content for tab 1

This is the content for the first tab.

Content for tab 2

This is the content for the second tab.

``` ```nunjucks {% from "_example.njk" import example %} {{ example({ group: "components", item: "tabs", example: "default", html: true, nunjucks: true, open: false, size: "xl", loading: "eager" }) }} ``` -------------------------------- ### Multiple Tags Example Source: https://github.com/alphagov/govuk-design-system/blob/main/src/components/tag/index.md Demonstrates how to use multiple tags to show different statuses. This example uses HTML and Nunjucks. ```html Active Inactive ``` ```nunjucks {% from "govuk/components/tag/macro.njk" import govukTag %} {{ govukTag({ text: "Active" }) }} {{ govukTag({ text: "Inactive" }) }} ``` -------------------------------- ### Start Local Server with External Connections Enabled Source: https://github.com/alphagov/govuk-design-system/blob/main/README.md To allow connections from other devices on your network, set the ALLOW_EXTERNAL_CONNECTIONS environment variable to true before starting the server. ```shell ALLOW_EXTERNAL_CONNECTIONS=true npm start ``` -------------------------------- ### Default phase banner example Source: https://github.com/alphagov/govuk-design-system/blob/main/src/components/phase-banner/index.md Use this example to display a default phase banner. It can be rendered using HTML or Nunjucks. ```html

This is a new service – your feedback will help us improve it.

``` ```nunjucks {% from "govuk-frontend/components/phase-banner/macro.njk" import govukPhaseBanner %} {{ govukPhaseBanner({ "html": "This is a new service – your feedback will help us improve it." }) }} ``` -------------------------------- ### Second File Upload Example Source: https://github.com/alphagov/govuk-design-system/blob/main/src/components/file-upload/index.md An alternative default file upload example, useful for demonstrating variations or multiple uploads within a service. ```html
``` -------------------------------- ### Default Accordion Example Source: https://github.com/alphagov/govuk-design-system/blob/main/src/components/accordion/index.md This example shows the default configuration for an accordion component. It includes HTML and Nunjucks templating options. ```html

``` ```nunjucks {% from "_example.njk" import example %} {{ example({ group: "components", item: "accordion", example: "default", html: true, nunjucks: true, open: false, size: "xl", loading: "eager" }) }} ``` -------------------------------- ### Second Default Button Example Source: https://github.com/alphagov/govuk-design-system/blob/main/src/components/button/index.md An example of a second default button, demonstrating how to differentiate if multiple are needed, though generally discouraged. ```html ``` ```nunjucks {% from "govuk-prototype-components/lib/macro.njk" import govukButton %} {{ govukButton({ text: 'Continue', titleSuffix: 'second' }) }} ``` -------------------------------- ### Example of Alt Text for an Image Source: https://github.com/alphagov/govuk-design-system/blob/main/src/styles/images/index.md This example demonstrates how to implement alt text for an image. Ensure alt text is concise, meaningful, and describes the content and function of the image. ```html Description of the image content and function ``` -------------------------------- ### Default radios example Source: https://github.com/alphagov/govuk-design-system/blob/main/src/components/radios/index.md This is the default example of the radios component, suitable for most use cases. It includes HTML and Nunjucks versions. ```html
``` ```nunjucks {% from "govuk-frontend/components/radios/macro.njk" import radios %} {{ radios({ idPrefix: "where-do-you-live", name: "where-do-you-live", items: [ { value: "england", text: "England" }, { value: "scotland", text: "Scotland" }, { value: "wales", text: "Wales" }, { value: "northern-ireland", text: "Northern Ireland" } ] }) }} ``` -------------------------------- ### Default List Example Source: https://github.com/alphagov/govuk-design-system/blob/main/src/styles/lists/index.md This is a basic example of a list. It is used to make blocks of text easier to read and break information into manageable chunks. ```html ``` -------------------------------- ### Start Local Development Server Source: https://github.com/alphagov/govuk-design-system/blob/main/README.md This command builds the project sources, serves the pages, and watches for file changes to enable live reloading during development. ```shell npm start ``` -------------------------------- ### Service navigation with service name and links Source: https://github.com/alphagov/govuk-design-system/blob/main/src/components/service-navigation/index.md This example shows how to display both the service name and navigation links. Ensure navigation links are relevant to the user's current task. ```html ``` -------------------------------- ### Bulleted List Example Source: https://github.com/alphagov/govuk-design-system/blob/main/src/styles/lists/index.md Use bulleted lists when the order of items is not important. Introduce with a lead-in line ending in a colon, start items with a lowercase letter, and do not use a full stop. ```html ``` -------------------------------- ### Grid System: Example Combinations Source: https://github.com/alphagov/govuk-design-system/blob/main/src/styles/layout/index.md Illustrates how to combine different grid column classes within a `govuk-grid-row` to create complex page layouts. ```html
``` -------------------------------- ### Bank details form with payment choice Source: https://github.com/alphagov/govuk-design-system/blob/main/src/patterns/bank-details/index.md Adapt this pattern when users can choose how they get paid, for example, by bank transfer or an alternative method. This handles scenarios where not all users have or want to share bank account details online. ```Nunjucks {{ example({ group: "patterns", item: "bank-details", example: "branch", html: true, nunjucks: true, open: false, size: "xl" }) }} ``` -------------------------------- ### Contact a department or service team - All contact information example Source: https://github.com/alphagov/govuk-design-system/blob/main/src/patterns/contact-a-department-or-service-team/index.md Comprehensive example showing various contact channels including phone, email, social media, and opening hours. ```html

Contact the team

You can contact the team by:

Our opening hours are:

Monday to Friday, 9am to 5pm

We aim to respond to emails within 2 working days.

Calls may be recorded for quality and training purposes. Calls cost no more than national calls to 01 and 02 numbers.

``` -------------------------------- ### Tabs Component with Second Example Source: https://github.com/alphagov/govuk-design-system/blob/main/src/components/tabs/index.md Demonstrates an alternative configuration for the tabs component, useful for showcasing different content arrangements or states. ```html

Content for tab 1

This is the content for the first tab.

Content for tab 2

This is the content for the second tab.

``` ```nunjucks {% from "_example.njk" import example %} {{ example({ group: "components", item: "tabs", example: "default", html: true, nunjucks: true, open: false, size: "xl", titleSuffix: "second" }) }} ``` -------------------------------- ### Default inset text example Source: https://github.com/alphagov/govuk-design-system/blob/main/src/components/inset-text/index.md This is a basic example of the inset text component. It can be used with HTML or Nunjucks. ```html

The text in this box is inset.

``` ```nunjucks {% from "govuk/components/inset-text/macro.njk" import govukInsetText %} {{ govukInsetText({ html: "

The text in this box is inset.

" }) }} ``` -------------------------------- ### Default notification banner example Source: https://github.com/alphagov/govuk-design-system/blob/main/src/components/notification-banner/index.md This is a basic example of a notification banner. It is used to display general information to the user. ```nunjucks {% from "_example.njk" import example %} {{ example({ group: "components", item: "notification-banner", example: "default", html: true, nunjucks: true, open: false, size: "s", loading: "eager" }) }} ``` -------------------------------- ### Default fieldset example Source: https://github.com/alphagov/govuk-design-system/blob/main/src/components/fieldset/index.md This is a basic example of a fieldset component. The legend serves as a heading for the grouped form inputs. ```html

Personal details

``` -------------------------------- ### Default password input example Source: https://github.com/alphagov/govuk-design-system/blob/main/src/components/password-input/index.md Use this component whenever you need users to create or enter a password. Ensure to read related patterns for asking users for passwords and creating user accounts. ```html
``` ```nunjucks {% from "govuk/components/password-input/macro.njk" import govukPasswordInput %} {{ govukPasswordInput({ label: { text: "Password" }, id: "password-input-1", name: "password-input-1", autocomplete: "new-password" }) }} ``` -------------------------------- ### Default warning text example Source: https://github.com/alphagov/govuk-design-system/blob/main/src/components/warning-text/index.md This is a basic example of the warning text component. The 'Warning' text can be rewritten to be more specific to the context. ```html
Warning You now have unlimited 10 minute குழந்தைகளுக்கான வீடியோக்கள் to watch.
``` ```nunjucks {% from "govuk/components/warning-text/macro.njk" import govukWarningText %} {{ govukWarningText({ text: "You now have unlimited 10 minute குழந்தைகளுக்கான வீடியோக்கள் to watch." }) }} ``` -------------------------------- ### Add content at the start of the container Source: https://github.com/alphagov/govuk-design-system/blob/main/src/styles/page-template/index.md Use 'containerStart' to add content immediately after the opening `
` element. This is suitable for components like Back links or Breadcrumbs. ```Nunjucks {%- call addNunjucksOption(options, 'containerStart', 'Block') -%} Add content after the opening `
` element that limits the width of the page. For example: the [Back link component](/components/back-link), [Breadcrumbs component](/components/breadcrumbs). {%- endcall %} ``` -------------------------------- ### Equality Information Explainer Screen Source: https://github.com/alphagov/govuk-design-system/blob/main/src/patterns/equality-information/index.md Use this example to show users why you are asking for equality information and what you will do with it. This is typically displayed before the equality questions themselves. ```html

Equality information

We ask for this information to help us understand and improve our services for everyone. It is optional and will be kept confidential.

Find out more about why we ask for equality information

``` -------------------------------- ### Cookie banner example Source: https://github.com/alphagov/govuk-design-system/blob/main/src/components/cookie-banner/index.md This is a default example of the cookie banner component. It is intended for general use when a cookie banner is required. ```html ``` -------------------------------- ### Spaced List Example Source: https://github.com/alphagov/govuk-design-system/blob/main/src/styles/lists/index.md This example demonstrates how to add extra spacing between list items when they span multiple lines, improving readability. ```html ``` -------------------------------- ### Summary list with missing information Source: https://github.com/alphagov/govuk-design-system/blob/main/src/components/summary-list/index.md This example shows how to display rows where information is missing. A link is provided in the 'value' column to allow users to enter the required information. ```html
Full name
Sarah Philips
Change full name
Date of birth
Enter date of birth
National insurance number
QQ 12 34 56 C
Change national insurance number
``` -------------------------------- ### Create a button in a detailed guide Source: https://github.com/alphagov/govuk-design-system/blob/main/src/patterns/start-using-a-service/index.md Use this Markdown to create a button within a detailed guide in Whitehall Publisher. This is for non-mainstream services. ```plaintext {button start}[Button text goes here](https://servicename.service.gov.uk/first-page-within-service){/button} ``` -------------------------------- ### Add content before main content (deprecated) Source: https://github.com/alphagov/govuk-design-system/blob/main/src/styles/page-template/index.md The 'beforeContent' option is deprecated and should be replaced by 'containerStart'. It was used to add content outside the `
` element. ```Nunjucks {%- call addNunjucksOption(options, 'beforeContent', 'Block') -%} Deprecated - Use [`containerStart`](#containerstart-block) instead. Add content that needs to appear outside the `
` element. For example: the [Back link component](/components/back-link), [Breadcrumbs component](/components/breadcrumbs). {%- endcall %} ```