Header
<gcds-header>
Also called: global header, brand header.
The header is the responsive Government of Canada branded header landmark.
-
Required on Canada.ca -
Required on GC sites
-
GitHub -
Figma
Header component preview
On this page
Coding and accessibility for headers
GC Design System components are designed to adapt to the size of the screen or frame where they’re being viewed. As an exception, the text size in the header and footer is fixed.
Preserve the signature element in the header for GC sites
- Maintain the signature for all GC sites.
- Use the
signature-variantattribute to set the Government of Canada signature to eithercolourorwhite. For white backgrounds, keep thecolourdefault setting for the signature. - Always preserve the integrity of the Government of Canada signature. Avoid modifying it in any way, stretching, or changing the colours or text.
- On Canada.ca pages, set the
signature-has-linkattribute totrueto set the Government of Canada signature link to Canada.ca.
Include the language toggle on all GC sites
- Include the language toggle by setting the
lang-hrefattribute. Setting thelang-hrefalso sets the href of the language toggle. - Use the
langattribute to set the site language and the toggle will offer the other Official Language.
Set up the skip-to-content to improve accessibility
- Set up a skip-to-content link as a shortcut for people using an assistive technology and improve keyboard navigation.
- Set the href of the
skip-to-contentlink in the header’s top navigation using theskip-to-hrefattribute. - Use the
skip-to-navslot to replace the default top navigation with theskip-to-contentlink. - Pass a child element with the
slot="skip-to-nav"attribute to place the element first in the header.
Include the breadcrumbs and search on Canada.ca sites
- On Canada.ca pages, keep the default setting of
hide-canada-linktofalse. - Add the breadcrumbs component by passing a child element with the
slot="breadcrumb"attribute. This will place the breadcrumbs in the header below the language toggle, signature and search slot. - Add a new breadcrumbs link to the breadcrumbs component by using the
gcds-breadcrumbs-itemcomponent. The link can be added through thehrefproperty. - Include a search form by adding by adding
<gcds-search slot="search"></gcds-search>or passing a child element with theslot="search"attribute. This will place the element under the language toggle and beside the signature in the header. - Set the search to a local or global search form. By default, the component is set to search Canada.ca.
Set up a top navigation
- Add a top navigation by passing a child element with the
slot="menu"attribute. This will place the element in the header below the language toggle, signature, and search slots. - Opt to add a banner by passing a child element with the
slot="banner"attribute. This will place the element across the top of the header under theskip-to-navelement.
In this section
lang-href
The lang-href attribute specifies the URL of the same page in another language, typically English or French. Use this attribute to provide a link that allows users to switch between available language versions.
<gcds-header lang-href="fr-url-here" skip-to-href="#id-main-content-here">
</gcds-header>
skip-to-href
The skip-to-href attribute specifies the URL or anchor for the "Skip to content" link. This link allows users, especially those using assistive technologies, to quickly navigate to the main content of the page, improving accessibility.
<gcds-header lang-href="fr-url-here" skip-to-href="#id-main-content-here">
</gcds-header>
signature-has-link
The signature-has-link attribute determines whether the header signature links to Canada.ca. By default, it's set to true, which means the signature is clickable.
<gcds-header lang-href="fr-url-here" skip-to-href="#id-main-content-here">
</gcds-header>
When it's set to false, a non-clickable signature is displayed.
<gcds-header lang-href="fr-url-here" skip-to-href="#id-main-content-here" signature-has-link="false">
</gcds-header>
banner
The banner slot is for adding a banner across the top of the header. Use this slot to display site-wide alerts or promotional messages.
<gcds-header lang-href="fr-url-here" skip-to-href="#id-main-content-here">
<div slot="banner">Banner slot</div>
</gcds-header>
breadcrumb
The breadcrumb slot is for adding breadcrumbs below the header. Use this slot to show the user’s current page location and navigation path.
<gcds-header lang-href="fr-url-here" skip-to-href="#id-main-content-here">
<gcds-breadcrumbs slot="breadcrumb">
<gcds-breadcrumbs-item href="#">Home page</gcds-breadcrumbs-item>
<gcds-breadcrumbs-item href="#">Parent page link</gcds-breadcrumbs-item>
</gcds-breadcrumbs>
</gcds-header>
menu
The menu slot is for adding a navigation menu below the divider line. For instance, you can use the top-nav component within this slot to provide the site’s primary navigation links.
<gcds-header lang-href="fr-url-here" skip-to-href="#id-main-content-here">
<gcds-top-nav label="Top navigation" alignment="right" slot="menu">
<gcds-nav-link href="#home" slot="home">GC Notify</gcds-nav-link>
<gcds-nav-link href="#">Why GC Notify</gcds-nav-link>
<gcds-nav-link href="#">Contact us</gcds-nav-link>
</gcds-top-nav>
</gcds-header>
search
The search slot is for adding a search field to the header. Use this slot to allow users to search site content directly from the header.
<gcds-header lang-href="fr-url-here" skip-to-href="#id-main-content-here">
<gcds-search slot="search"></gcds-search>
</gcds-header>
signature
The signature slot is for replacing the default Government of Canada signature. Use this slot to display a custom signature or logo if needed.
<gcds-header lang-href="fr-url-here" skip-to-href="#id-main-content-here">
<gcds-signature slot="signature"></gcds-signature>
</gcds-header>
skip-to-nav
The skip-to-nav slot is for adding a "skip to content" link at the top of the header. By default, the header includes a “skip to main content” link to improve accessibility for users of assistive technologies. The target for this default link can be set using the skip-to-href prop. Use this slot to add additional skip links or a custom “skip to content” link.
<gcds-header lang-href="fr-url-here" skip-to-href="#id-main-content-here">
<gcds-link href="#main-content" slot="skip-to-nav">Skip to main content</gcds-link>
</gcds-header>
toggle
The toggle slot is for adding a custom language toggle in the header. By default, the header includes a language toggle that includes English and French. The target for this default language toggle can be set using the lang-href prop. Use this slot to add additional available languages.
<gcds-header lang-href="fr-url-here" skip-to-href="#id-main-content-here">
<gcds-lang-toggle href="url-here" slot="toggle">
</gcds-lang-toggle>
</gcds-header>
Code builder
Generate an instance of the component you need by selecting its code properties.
-
Explore by choosing different code values to generate the instance you want.
-
Get the code and pull it into your environment.
-
Add any copy you need to the component (like text for a label).
Note: The code builder uses English for all code elements, which follows standard practice.
Help us improve
Have questions or a request? Give feedback on our contact form.
Something's wrong? Raise it through GitHub with an