# Header ## Introduction The header component is used at the top of every GOV.UK page, to help users navigate. ## Guidance Find out when to use the header component in your service in the [GOV.UK Design System](https://design-system.service.gov.uk/components/header). ## Quick start examples ### Header [Preview this example in the Frontend review app](http://govuk-frontend-review.herokuapp.com/components/header/preview) #### Markup #### Macro {% from "header/macro.njk" import govukHeader %} {{ govukHeader({}) }} ### Header with service name [Preview this example in the Frontend review app](http://govuk-frontend-review.herokuapp.com/components/header/with-service-name/preview) #### Markup #### Macro {% from "header/macro.njk" import govukHeader %} {{ govukHeader({ "serviceName": "Service Name", "serviceUrl": "/components/header" }) }} ### Header with navigation [Preview this example in the Frontend review app](http://govuk-frontend-review.herokuapp.com/components/header/with-navigation/preview) #### Markup #### Macro {% from "header/macro.njk" import govukHeader %} {{ govukHeader({ "navigation": [ { "href": "#1", "text": "Navigation item 1", "active": true }, { "href": "#2", "text": "Navigation item 2" }, { "href": "#3", "text": "Navigation item 3" }, { "href": "#4", "text": "Navigation item 4" } ] }) }} ### Header with service name and navigation [Preview this example in the Frontend review app](http://govuk-frontend-review.herokuapp.com/components/header/with-service-name-and-navigation/preview) #### Markup #### Macro {% from "header/macro.njk" import govukHeader %} {{ govukHeader({ "serviceName": "Service Name", "serviceUrl": "/components/header", "navigation": [ { "href": "#1", "text": "Navigation item 1", "active": true }, { "href": "#2", "text": "Navigation item 2" }, { "href": "#3", "text": "Navigation item 3" }, { "href": "#4", "text": "Navigation item 4" } ] }) }} ## Requirements ### Build tool configuration When compiling the Sass files you'll need to define includePaths to reference the node_modules directory. Below is a sample configuration using gulp .pipe(sass({ includePaths: 'node_modules/' })) ### Static asset path configuration In order to include the images used in the components, you need to configure your app to show these assets. Below is a sample configuration using Express js: app.use('/assets', express.static(path.join(__dirname, '/node_modules/govuk-frontend/assets'))) ## Component options Use options to customise the appearance, content and behaviour of a component when using a macro, for example, changing the text. See [options table](https://design-system.service.gov.uk/components/header/#options-example-default) for details. ### Setting up Nunjucks views and paths Below is an example setup using express configure views: nunjucks.configure('node_modules/govuk-frontend/components', { autoescape: true, cache: false, express: app }) ## Contribution Guidelines can be found at [on our Github repository.](https://github.com/alphagov/govuk-frontend/blob/master/CONTRIBUTING.md "link to contributing guidelines on our github repository") ## License MIT