Service navigation examples
-
# default
{ "navigation": [ { "href": "#/1", "text": "Navigation item 1" }, { "href": "#/2", "text": "Navigation item 2" }, { "href": "#/3", "text": "Navigation item 3" }, { "href": "#/4", "text": "Navigation item 4" } ] }{% from "govuk/components/service-navigation/macro.njk" import govukServiceNavigation %} {{ govukServiceNavigation({ "navigation": [ { "href": "#/1", "text": "Navigation item 1" }, { "href": "#/2", "text": "Navigation item 2" }, { "href": "#/3", "text": "Navigation item 3" }, { "href": "#/4", "text": "Navigation item 4" } ] }) }} -
# with navigation with a current item
{ "navigation": [ { "href": "#/1", "text": "Navigation item 1" }, { "href": "#/2", "text": "Navigation item 2", "current": true }, { "href": "#/3", "text": "Navigation item 3" }, { "href": "#/4", "text": "Navigation item 4" } ] }{% from "govuk/components/service-navigation/macro.njk" import govukServiceNavigation %} {{ govukServiceNavigation({ "navigation": [ { "href": "#/1", "text": "Navigation item 1" }, { "href": "#/2", "text": "Navigation item 2", "current": true }, { "href": "#/3", "text": "Navigation item 3" }, { "href": "#/4", "text": "Navigation item 4" } ] }) }} -
# with large navigation
{ "navigation": [ { "href": "#/browse/benefits", "text": "Benefits" }, { "href": "#/browse/births-deaths-marriages", "text": "Births, deaths, marriages and care" }, { "href": "#/browse/business", "text": "Business and self-employed" }, { "href": "#/browse/childcare-parenting", "text": "Childcare and parenting" }, { "href": "#/browse/citizenship", "text": "Citizenship and living in the UK" }, { "href": "#/browse/justice", "text": "Crime, justice and the law" }, { "href": "#/browse/disabilities", "text": "Disabled people" }, { "href": "#/browse/driving", "text": "Driving and transport" }, { "href": "#/browse/education", "text": "Education and learning" }, { "href": "#/browse/employing-people", "text": "Employing people" }, { "href": "#/browse/environment-countryside", "text": "Environment and countryside" }, { "href": "#/browse/housing-local-services", "text": "Housing and local services" }, { "href": "#/browse/tax", "text": "Money and tax" }, { "href": "#/browse/abroad", "text": "Passports, travel and living abroad" }, { "href": "#/browse/visas-immigration", "text": "Visas and immigration" }, { "href": "#/browse/working", "text": "Working, jobs and pensions" } ] }{% from "govuk/components/service-navigation/macro.njk" import govukServiceNavigation %} {{ govukServiceNavigation({ "navigation": [ { "href": "#/browse/benefits", "text": "Benefits" }, { "href": "#/browse/births-deaths-marriages", "text": "Births, deaths, marriages and care" }, { "href": "#/browse/business", "text": "Business and self-employed" }, { "href": "#/browse/childcare-parenting", "text": "Childcare and parenting" }, { "href": "#/browse/citizenship", "text": "Citizenship and living in the UK" }, { "href": "#/browse/justice", "text": "Crime, justice and the law" }, { "href": "#/browse/disabilities", "text": "Disabled people" }, { "href": "#/browse/driving", "text": "Driving and transport" }, { "href": "#/browse/education", "text": "Education and learning" }, { "href": "#/browse/employing-people", "text": "Employing people" }, { "href": "#/browse/environment-countryside", "text": "Environment and countryside" }, { "href": "#/browse/housing-local-services", "text": "Housing and local services" }, { "href": "#/browse/tax", "text": "Money and tax" }, { "href": "#/browse/abroad", "text": "Passports, travel and living abroad" }, { "href": "#/browse/visas-immigration", "text": "Visas and immigration" }, { "href": "#/browse/working", "text": "Working, jobs and pensions" } ] }) }} -
# with HTML navigation items
{ "navigation": [ { "href": "#/1", "html": "<em>Navigation item 1</em>" }, { "href": "#/2", "html": "<em>Navigation item 2</em>" }, { "href": "#/3", "html": "<em>Navigation item 3</em>" } ] }{% from "govuk/components/service-navigation/macro.njk" import govukServiceNavigation %} {{ govukServiceNavigation({ "navigation": [ { "href": "#/1", "html": "<em>Navigation item 1</em>" }, { "href": "#/2", "html": "<em>Navigation item 2</em>" }, { "href": "#/3", "html": "<em>Navigation item 3</em>" } ] }) }} -
# with non-link navigation items
{ "navigation": [ { "text": "Navigation item 1" }, { "html": "<em>Navigation item 2</em>" }, { "text": "Navigation item 3" } ] }{% from "govuk/components/service-navigation/macro.njk" import govukServiceNavigation %} {{ govukServiceNavigation({ "navigation": [ { "text": "Navigation item 1" }, { "html": "<em>Navigation item 2</em>" }, { "text": "Navigation item 3" } ] }) }} -
# with service name
-
# with service link
-
# with long service name
{ "serviceName": "Apply to receive a rare holofoil Charizard Pokémon card from the King", "serviceUrl": "#/" }{% from "govuk/components/service-navigation/macro.njk" import govukServiceNavigation %} {{ govukServiceNavigation({ "serviceName": "Apply to receive a rare holofoil Charizard Pokémon card from the King", "serviceUrl": "#/" }) }} -
# with service name and navigation
{ "serviceName": "Apply for a juggling license", "serviceUrl": "#/", "navigation": [ { "href": "#/1", "text": "Navigation item 1" }, { "href": "#/2", "text": "Navigation item 2", "active": true }, { "href": "#/3", "text": "Navigation item 3" }, { "href": "#/4", "text": "Navigation item 4" } ] }{% from "govuk/components/service-navigation/macro.njk" import govukServiceNavigation %} {{ govukServiceNavigation({ "serviceName": "Apply for a juggling license", "serviceUrl": "#/", "navigation": [ { "href": "#/1", "text": "Navigation item 1" }, { "href": "#/2", "text": "Navigation item 2", "active": true }, { "href": "#/3", "text": "Navigation item 3" }, { "href": "#/4", "text": "Navigation item 4" } ] }) }} -
# inverse
{ "classes": "govuk-service-navigation--inverse", "serviceName": "Apply for a juggling license", "serviceUrl": "#/", "navigation": [ { "href": "#/1", "text": "Navigation item 1" }, { "href": "#/2", "text": "Navigation item 2", "active": true }, { "href": "#/3", "text": "Navigation item 3" }, { "href": "#/4", "text": "Navigation item 4" } ] }{% from "govuk/components/service-navigation/macro.njk" import govukServiceNavigation %} {{ govukServiceNavigation({ "classes": "govuk-service-navigation--inverse", "serviceName": "Apply for a juggling license", "serviceUrl": "#/", "navigation": [ { "href": "#/1", "text": "Navigation item 1" }, { "href": "#/2", "text": "Navigation item 2", "active": true }, { "href": "#/3", "text": "Navigation item 3" }, { "href": "#/4", "text": "Navigation item 4" } ] }) }} -
# with collapseNavigationOnMobile set to false
{ "serviceName": "Apply for a juggling license", "serviceUrl": "#/", "navigation": [ { "href": "#/1", "text": "Navigation item 1" }, { "href": "#/2", "text": "Navigation item 2", "active": true }, { "href": "#/3", "text": "Navigation item 3" }, { "href": "#/4", "text": "Navigation item 4" } ], "collapseNavigationOnMobile": false }{% from "govuk/components/service-navigation/macro.njk" import govukServiceNavigation %} {{ govukServiceNavigation({ "serviceName": "Apply for a juggling license", "serviceUrl": "#/", "navigation": [ { "href": "#/1", "text": "Navigation item 1" }, { "href": "#/2", "text": "Navigation item 2", "active": true }, { "href": "#/3", "text": "Navigation item 3" }, { "href": "#/4", "text": "Navigation item 4" } ], "collapseNavigationOnMobile": false }) }} -
# with a single navigation item
{ "serviceName": "Apply for a juggling license", "serviceUrl": "#/", "navigation": [ { "href": "#/1", "text": "Log out" } ] }{% from "govuk/components/service-navigation/macro.njk" import govukServiceNavigation %} {{ govukServiceNavigation({ "serviceName": "Apply for a juggling license", "serviceUrl": "#/", "navigation": [ { "href": "#/1", "text": "Log out" } ] }) }} -
# with a single navigation item and collapseNavigationOnMobile set to true
{ "serviceName": "Apply for a juggling license", "serviceUrl": "#/", "navigation": [ { "href": "#/1", "text": "Log out" } ], "collapseNavigationOnMobile": true }{% from "govuk/components/service-navigation/macro.njk" import govukServiceNavigation %} {{ govukServiceNavigation({ "serviceName": "Apply for a juggling license", "serviceUrl": "#/", "navigation": [ { "href": "#/1", "text": "Log out" } ], "collapseNavigationOnMobile": true }) }} -
# with no options set
-
# attributes
{ "serviceName": "Service name", "attributes": { "data-foo": "bar", "data-pika": "chu" } }{% from "govuk/components/service-navigation/macro.njk" import govukServiceNavigation %} {{ govukServiceNavigation({ "serviceName": "Service name", "attributes": { "data-foo": "bar", "data-pika": "chu" } }) }} -
# classes
-
# with custom aria-label
-
# with custom navigation toggle text
{ "menuButtonText": "Enter the NavZone", "navigation": [ { "href": "#/1", "text": "Navigation item 1" }, { "href": "#/2", "text": "Navigation item 2" } ] }{% from "govuk/components/service-navigation/macro.njk" import govukServiceNavigation %} {{ govukServiceNavigation({ "menuButtonText": "Enter the NavZone", "navigation": [ { "href": "#/1", "text": "Navigation item 1" }, { "href": "#/2", "text": "Navigation item 2" } ] }) }} -
# with custom navigation toggle label
{ "menuButtonLabel": "Enter the NavZone", "navigation": [ { "href": "#/1", "text": "Navigation item 1" }, { "href": "#/2", "text": "Navigation item 2" } ] }{% from "govuk/components/service-navigation/macro.njk" import govukServiceNavigation %} {{ govukServiceNavigation({ "menuButtonLabel": "Enter the NavZone", "navigation": [ { "href": "#/1", "text": "Navigation item 1" }, { "href": "#/2", "text": "Navigation item 2" } ] }) }} -
# with identical navigation toggle text and label
{ "menuButtonText": "Enter the NavZone", "menuButtonLabel": "Enter the NavZone", "navigation": [ { "href": "#/1", "text": "Navigation item 1" }, { "href": "#/2", "text": "Navigation item 2" } ] }{% from "govuk/components/service-navigation/macro.njk" import govukServiceNavigation %} {{ govukServiceNavigation({ "menuButtonText": "Enter the NavZone", "menuButtonLabel": "Enter the NavZone", "navigation": [ { "href": "#/1", "text": "Navigation item 1" }, { "href": "#/2", "text": "Navigation item 2" } ] }) }} -
# with custom navigation label
{ "navigationLabel": "Main navigation", "navigation": [ { "href": "#/1", "text": "Navigation item 1" }, { "href": "#/2", "text": "Navigation item 2" } ] }{% from "govuk/components/service-navigation/macro.njk" import govukServiceNavigation %} {{ govukServiceNavigation({ "navigationLabel": "Main navigation", "navigation": [ { "href": "#/1", "text": "Navigation item 1" }, { "href": "#/2", "text": "Navigation item 2" } ] }) }} -
# with custom navigation toggle text and navigation label
{ "menuButtonText": "Enter the NavZone", "navigationLabel": "The NavZone", "navigation": [ { "href": "#/1", "text": "Navigation item 1" }, { "href": "#/2", "text": "Navigation item 2" } ] }{% from "govuk/components/service-navigation/macro.njk" import govukServiceNavigation %} {{ govukServiceNavigation({ "menuButtonText": "Enter the NavZone", "navigationLabel": "The NavZone", "navigation": [ { "href": "#/1", "text": "Navigation item 1" }, { "href": "#/2", "text": "Navigation item 2" } ] }) }} -
# with custom navigation classes
{ "navigationClasses": "app-my-neat-navigation-class", "navigation": [ { "href": "#/1", "text": "Navigation item 1" }, { "href": "#/2", "text": "Navigation item 2" } ] }{% from "govuk/components/service-navigation/macro.njk" import govukServiceNavigation %} {{ govukServiceNavigation({ "navigationClasses": "app-my-neat-navigation-class", "navigation": [ { "href": "#/1", "text": "Navigation item 1" }, { "href": "#/2", "text": "Navigation item 2" } ] }) }} -
# with custom navigation ID
{ "navigationId": "main-nav", "navigation": [ { "href": "#/1", "text": "Navigation item 1" }, { "href": "#/2", "text": "Navigation item 2" } ] }{% from "govuk/components/service-navigation/macro.njk" import govukServiceNavigation %} {{ govukServiceNavigation({ "navigationId": "main-nav", "navigation": [ { "href": "#/1", "text": "Navigation item 1" }, { "href": "#/2", "text": "Navigation item 2" } ] }) }} -
# with navigation having empty values
{ "navigation": [ { "href": "#/1", "text": "Navigation item 1" }, null, false, "", null, { "href": "#/2", "text": "Navigation item 2" } ] }{% from "govuk/components/service-navigation/macro.njk" import govukServiceNavigation %} {{ govukServiceNavigation({ "navigation": [ { "href": "#/1", "text": "Navigation item 1" }, null, false, "", null, { "href": "#/2", "text": "Navigation item 2" } ] }) }} -
# with navigation having only empty values
-
# with navigation being an empty array
-
# with navigation with an active item
{ "navigation": [ { "href": "#/1", "text": "Navigation item 1" }, { "href": "#/2", "text": "Navigation item 2", "active": true }, { "href": "#/3", "text": "Navigation item 3" }, { "href": "#/4", "text": "Navigation item 4" } ] }{% from "govuk/components/service-navigation/macro.njk" import govukServiceNavigation %} {{ govukServiceNavigation({ "navigation": [ { "href": "#/1", "text": "Navigation item 1" }, { "href": "#/2", "text": "Navigation item 2", "active": true }, { "href": "#/3", "text": "Navigation item 3" }, { "href": "#/4", "text": "Navigation item 4" } ] }) }} -
# with slotted content
{ "slots": { "start": "<div>[start]</div>", "end": "<div>[end]</div>", "navigationStart": "<li>[navigation start]</li>", "navigationEnd": "<li>[navigation end]</li>" } }{% from "govuk/components/service-navigation/macro.njk" import govukServiceNavigation %} {{ govukServiceNavigation({ "slots": { "start": "<div>[start]</div>", "end": "<div>[end]</div>", "navigationStart": "<li>[navigation start]</li>", "navigationEnd": "<li>[navigation end]</li>" } }) }} -
# rebrand
{ "navigation": [ { "href": "#/1", "text": "Navigation item 1" }, { "href": "#/2", "text": "Navigation item 2" }, { "href": "#/3", "text": "Navigation item 3" }, { "href": "#/4", "text": "Navigation item 4" } ] }{% from "govuk/components/service-navigation/macro.njk" import govukServiceNavigation %} {{ govukServiceNavigation({ "navigation": [ { "href": "#/1", "text": "Navigation item 1" }, { "href": "#/2", "text": "Navigation item 2" }, { "href": "#/3", "text": "Navigation item 3" }, { "href": "#/4", "text": "Navigation item 4" } ] }) }}