Top navigation
Component demo
Interactive example
<ic-top-navigation app-title="ICDS" status="alpha" version="v0.0.7"> <svg slot="app-icon" xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 0 24 24" width="24" fill="#000000" > <path d="M0 0h24v24H0V0z" fill="none" /> <path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8zm-5.5-2.5l7.51-3.49L17.5 6.5 9.99 9.99 6.5 17.5zm5.5-6.6c.61 0 1.1.49 1.1 1.1s-.49 1.1-1.1 1.1-1.1-.49-1.1-1.1.49-1.1 1.1-1.1z" /> </svg> <ic-search-bar slot="search" placeholder="Search" label="Search" ></ic-search-bar> <ic-navigation-button label="Notifications" slot="buttons"> <svg slot="icon" xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 0 24 24" width="24" fill="#000000" > <path d="M12 22c1.1 0 2-.9 2-2h-4c0 1.1.89 2 2 2zm6-6v-5c0-3.07-1.64-5.64-4.5-6.32V4c0-.83-.67-1.5-1.5-1.5s-1.5.67-1.5 1.5v.68C7.63 5.36 6 7.92 6 11v5l-2 2v1h16v-1l-2-2z" /> </svg> </ic-navigation-button> <ic-navigation-item slot="navigation" label="Get started" href="#" ></ic-navigation-item> <ic-navigation-item slot="navigation" label="Accessibility" href="#" ></ic-navigation-item> <ic-navigation-item slot="navigation" label="Styles" href="#" ></ic-navigation-item> <ic-navigation-item slot="navigation" label="Components" href="#" selected="true" ></ic-navigation-item> <ic-navigation-item slot="navigation" label="Patterns" href="#" ></ic-navigation-item></ic-top-navigation>
<IcTopNavigation appTitle="ICDS" status="alpha" version="v0.0.7"> <SlottedSVG slot="app-icon" xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 0 24 24" width="24" fill="#000000" > <path d="M0 0h24v24H0V0z" fill="none" /> <path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8zm-5.5-2.5l7.51-3.49L17.5 6.5 9.99 9.99 6.5 17.5zm5.5-6.6c.61 0 1.1.49 1.1 1.1s-.49 1.1-1.1 1.1-1.1-.49-1.1-1.1.49-1.1 1.1-1.1z" /> </SlottedSVG> <IcSearchBar slot="search" placeholder="Search" label="Search" /> <IcNavigationButton label="Notifications" slot="buttons"> <SlottedSVG slot="icon" xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 0 24 24" width="24" fill="#000000" > <path d="M12 22c1.1 0 2-.9 2-2h-4c0 1.1.89 2 2 2zm6-6v-5c0-3.07-1.64-5.64-4.5-6.32V4c0-.83-.67-1.5-1.5-1.5s-1.5.67-1.5 1.5v.68C7.63 5.36 6 7.92 6 11v5l-2 2v1h16v-1l-2-2z" /> </SlottedSVG> </IcNavigationButton> <IcNavigationItem slot="navigation" label="Get started" href="#" /> <IcNavigationItem slot="navigation" label="Accessibility" href="#" /> <IcNavigationItem slot="navigation" label="Styles" href="#" /> <IcNavigationItem slot="navigation" label="Components" href="#" selected /> <IcNavigationItem slot="navigation" label="Patterns" href="#" /></IcTopNavigation>
Top navigation details
Props
All components also accept native properties supported by the DOM, such as className
and style
.
The app title to be displayed. This is required, unless a slotted app title link is used. | ||
The alignment of the top navigation content. | ||
Can set a custom breakpoint for the top navigation to switch to mobile mode.
Must be one of our specified breakpoints in px: | ||
The URL to navigate to when the app title is clicked. | ||
If | ||
The short title of the app to be displayed at small screen sizes in place of the app title. | ||
The status info to be displayed. | ||
The version info to be displayed. |
The app title to be displayed. This is required, unless a slotted app title link is used. |
The alignment of the top navigation content. |
Can set a custom breakpoint for the top navigation to switch to mobile mode.
Must be one of our specified breakpoints in px: |
The URL to navigate to when the app title is clicked. |
If |
The short title of the app to be displayed at small screen sizes in place of the app title. |
The status info to be displayed. |
The version info to be displayed. |
Slots
A slot allows for any type of element or markup to be passed into and rendered within a web component. This creates more flexibility than using a prop which must take a specific type of data.
Content can be slotted into a component by adding it as a top-level child of the component.
Slots can have a name to identify them. These specify which slot the content will be inserted into, and therefore where it will be rendered and how it will be used within the component. The name of the slot to be used can be specified by passing it via a slot
attribute on the slotted content.
Events
All components also accept native events supported by the DOM, such as onClick
and onKeyDown
.
Navigation group details
Props
All components also accept native properties supported by the DOM, such as className
and style
.
If | ||
The label to display on the group. |
If |
The label to display on the group. |
CSS Custom Properties
Methods
Navigation item details
Props
All components also accept native properties supported by the DOM, such as className
and style
.
If | ||
The destination of the navigation item. | ||
The human language of the linked URL. | ||
The label of the navigation item. | ||
How much of the referrer to send when following the link. | ||
The relationship of the linked URL as space-separated link types. | ||
If | ||
The place to display the linked URL, as the name for a browsing context (a tab, window, or iframe). |
If |
The destination of the navigation item. |
The human language of the linked URL. |
The label of the navigation item. |
How much of the referrer to send when following the link. |
The relationship of the linked URL as space-separated link types. |
If |
The place to display the linked URL, as the name for a browsing context (a tab, window, or iframe). |
Slots
A slot allows for any type of element or markup to be passed into and rendered within a web component. This creates more flexibility than using a prop which must take a specific type of data.
Content can be slotted into a component by adding it as a top-level child of the component.
Slots can have a name to identify them. These specify which slot the content will be inserted into, and therefore where it will be rendered and how it will be used within the component. The name of the slot to be used can be specified by passing it via a slot
attribute on the slotted content.
CSS Custom Properties
Methods
Navigation button details
Props
All components also accept native properties supported by the DOM, such as className
and style
.
The label info to display. | ||
If | ||
The URL that the link points to. This will render the button as an "a" tag. | ||
The human language of the linked URL. | ||
How much of the referrer to send when following the link. | ||
The relationship of the linked URL as space-separated link types. | ||
The place to display the linked URL, as the name for a browsing context (a tab, window, or iframe). |
The label info to display. |
If |
The URL that the link points to. This will render the button as an "a" tag. |
The human language of the linked URL. |
How much of the referrer to send when following the link. |
The relationship of the linked URL as space-separated link types. |
The place to display the linked URL, as the name for a browsing context (a tab, window, or iframe). |
Slots
A slot allows for any type of element or markup to be passed into and rendered within a web component. This creates more flexibility than using a prop which must take a specific type of data.
Content can be slotted into a component by adding it as a top-level child of the component.
Slots can have a name to identify them. These specify which slot the content will be inserted into, and therefore where it will be rendered and how it will be used within the component. The name of the slot to be used can be specified by passing it via a slot
attribute on the slotted content.
Methods
Variants
Grouped links
Interactive example
<ic-top-navigation app-title="ICDS" status="alpha" version="v0.0.7"> <svg slot="app-icon" xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 0 24 24" width="24" fill="#000000" > <path d="M0 0h24v24H0V0z" fill="none" /> <path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8zm-5.5-2.5l7.51-3.49L17.5 6.5 9.99 9.99 6.5 17.5zm5.5-6.6c.61 0 1.1.49 1.1 1.1s-.49 1.1-1.1 1.1-1.1-.49-1.1-1.1.49-1.1 1.1-1.1z" /> </svg> <ic-search-bar slot="search" placeholder="Search" label="Search" ></ic-search-bar> <ic-navigation-group slot="navigation" label="Get started"> <ic-navigation-item label="Tests" href="#"></ic-navigation-item> <ic-navigation-item label="Theme" href="#"></ic-navigation-item> <ic-navigation-item label="Design" href="#"></ic-navigation-item> </ic-navigation-group> <ic-navigation-group slot="navigation" label="Accessibility" expandable="true" > <ic-navigation-item label="Introduction" href="#"></ic-navigation-item> <ic-navigation-item label="Accessibility Statement" href="#" ></ic-navigation-item> </ic-navigation-group></ic-top-navigation>
<IcTopNavigation appTitle="ICDS" status="alpha" version="v0.0.7"> <SlottedSVG slot="app-icon" xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 0 24 24" width="24" fill="#000000" > <path d="M0 0h24v24H0V0z" fill="none" /> <path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8zm-5.5-2.5l7.51-3.49L17.5 6.5 9.99 9.99 6.5 17.5zm5.5-6.6c.61 0 1.1.49 1.1 1.1s-.49 1.1-1.1 1.1-1.1-.49-1.1-1.1.49-1.1 1.1-1.1z" /> </SlottedSVG> <IcSearchBar slot="search" placeholder="Search" label="Search" /> <IcNavigationGroup slot="navigation" label="Get started"> <IcNavigationItem label="Tests" href="#" /> <IcNavigationItem label="Theme" href="#" /> <IcNavigationItem label="Design" href="#" /> </IcNavigationGroup> <IcNavigationGroup slot="navigation" label="Accessibility" expandable> <IcNavigationItem label="Introduction" href="#" /> <IcNavigationItem label="Accessibility statement" href="#" /> </IcNavigationGroup></IcTopNavigation>
Centre aligned
Interactive example
<ic-top-navigation app-title="ICDS" status="alpha" version="v0.0.7" content-aligned="center"> <svg slot="app-icon" xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 0 24 24" width="24" fill="#000000" > <path d="M0 0h24v24H0V0z" fill="none" /> <path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8zm-5.5-2.5l7.51-3.49L17.5 6.5 9.99 9.99 6.5 17.5zm5.5-6.6c.61 0 1.1.49 1.1 1.1s-.49 1.1-1.1 1.1-1.1-.49-1.1-1.1.49-1.1 1.1-1.1z" /> </svg> <ic-navigation-button label="Test button" slot="buttons" onclick="alert('test')" > <svg slot="icon" xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 0 24 24" width="24" fill="#000000" > <path d="M0 0h24v24H0V0z" fill="none" /> <path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8zm-5.5-2.5l7.51-3.49L17.5 6.5 9.99 9.99 6.5 17.5zm5.5-6.6c.61 0 1.1.49 1.1 1.1s-.49 1.1-1.1 1.1-1.1-.49-1.1-1.1.49-1.1 1.1-1.1z" /> </svg> </ic-navigation-button> <ic-navigation-item slot="navigation" label="Get started" href="/" ></ic-navigation-item> <ic-navigation-item slot="navigation" label="Accessibility" href="/" ></ic-navigation-item> <ic-navigation-item slot="navigation" label="Styles" href="/" ></ic-navigation-item> <ic-navigation-item slot="navigation" label="Components" href="/" selected="true" ></ic-navigation-item> <ic-navigation-item slot="navigation" label="Patterns" href="/" ></ic-navigation-item></ic-top-navigation>
<IcTopNavigation appTitle="ICDS" status="alpha" version="v0.0.7" contentAligned="center"> <SlottedSVG slot="app-icon" xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 0 24 24" width="24" fill="#000000" > <path d="M0 0h24v24H0V0z" fill="none" /> <path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8zm-5.5-2.5l7.51-3.49L17.5 6.5 9.99 9.99 6.5 17.5zm5.5-6.6c.61 0 1.1.49 1.1 1.1s-.49 1.1-1.1 1.1-1.1-.49-1.1-1.1.49-1.1 1.1-1.1z" /> </SlottedSVG> <IcNavigationButton label="Test button" slot="buttons" onClick={() => alert('test')} > <SlottedSVG slot="icon" xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 0 24 24" width="24" fill="#000000" > <path d="M0 0h24v24H0V0z" fill="none" /> <path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8zm-5.5-2.5l7.51-3.49L17.5 6.5 9.99 9.99 6.5 17.5zm5.5-6.6c.61 0 1.1.49 1.1 1.1s-.49 1.1-1.1 1.1-1.1-.49-1.1-1.1.49-1.1 1.1-1.1z" /> </SlottedSVG> </IcNavigationButton> <IcNavigationItem slot="navigation" label="Get started" href="/" /> <IcNavigationItem slot="navigation" label="Accessibility" href="/" /> <IcNavigationItem slot="navigation" label="Styles" href="/" /> <IcNavigationItem slot="navigation" label="Components" href="/" selected /> <IcNavigationItem slot="navigation" label="Patterns" href="/" /></IcTopNavigation>
Left aligned
Interactive example
<ic-top-navigation app-title="ICDS" status="alpha" version="v0.0.7" content-aligned="left"> <svg slot="app-icon" xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 0 24 24" width="24" fill="#000000" > <path d="M0 0h24v24H0V0z" fill="none" /> <path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8zm-5.5-2.5l7.51-3.49L17.5 6.5 9.99 9.99 6.5 17.5zm5.5-6.6c.61 0 1.1.49 1.1 1.1s-.49 1.1-1.1 1.1-1.1-.49-1.1-1.1.49-1.1 1.1-1.1z" /> </svg> <ic-search-bar slot="search" placeholder="Search" label="Search" ></ic-search-bar> <ic-navigation-button label="Test button" slot="buttons" onclick="alert('test')" > <svg slot="icon" xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 0 24 24" width="24" fill="#000000" > <path d="M0 0h24v24H0V0z" fill="none" /> <path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8zm-5.5-2.5l7.51-3.49L17.5 6.5 9.99 9.99 6.5 17.5zm5.5-6.6c.61 0 1.1.49 1.1 1.1s-.49 1.1-1.1 1.1-1.1-.49-1.1-1.1.49-1.1 1.1-1.1z" /> </svg> </ic-navigation-button> <ic-navigation-item slot="navigation" label="Get started" href="/" ></ic-navigation-item> <ic-navigation-item slot="navigation" label="Accessibility" href="/" ></ic-navigation-item> <ic-navigation-item slot="navigation" label="Styles" href="/" ></ic-navigation-item> <ic-navigation-item slot="navigation" label="Components" href="/" selected="true" ></ic-navigation-item> <ic-navigation-item slot="navigation" label="Patterns" href="/" ></ic-navigation-item></ic-top-navigation>
<IcTopNavigation appTitle="ICDS" status="alpha" version="v0.0.7" contentAligned="left"> <SlottedSVG slot="app-icon" xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 0 24 24" width="24" fill="#000000" > <path d="M0 0h24v24H0V0z" fill="none" /> <path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8zm-5.5-2.5l7.51-3.49L17.5 6.5 9.99 9.99 6.5 17.5zm5.5-6.6c.61 0 1.1.49 1.1 1.1s-.49 1.1-1.1 1.1-1.1-.49-1.1-1.1.49-1.1 1.1-1.1z" /> </SlottedSVG> <IcSearchBar slot="search" placeholder="Search" label="Search" /> <IcNavigationButton label="Test button" slot="buttons" onClick={() => alert('test')} > <SlottedSVG slot="icon" xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 0 24 24" width="24" fill="#000000" > <path d="M0 0h24v24H0V0z" fill="none" /> <path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8zm-5.5-2.5l7.51-3.49L17.5 6.5 9.99 9.99 6.5 17.5zm5.5-6.6c.61 0 1.1.49 1.1 1.1s-.49 1.1-1.1 1.1-1.1-.49-1.1-1.1.49-1.1 1.1-1.1z" /> </SlottedSVG> </IcNavigationButton> <IcNavigationItem slot="navigation" label="Get started" href="/" /> <IcNavigationItem slot="navigation" label="Accessibility" href="/" /> <IcNavigationItem slot="navigation" label="Styles" href="/" /> <IcNavigationItem slot="navigation" label="Components" href="/" selected /> <IcNavigationItem slot="navigation" label="Patterns" href="/" /></IcTopNavigation>
With badge on navigation button
Interactive example
<ic-top-navigation app-title="ICDS" status="alpha" version="v0.0.7"> <svg slot="app-icon" xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 0 24 24" width="24" fill="#000000" > <path d="M0 0h24v24H0V0z" fill="none" /> <path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8zm-5.5-2.5l7.51-3.49L17.5 6.5 9.99 9.99 6.5 17.5zm5.5-6.6c.61 0 1.1.49 1.1 1.1s-.49 1.1-1.1 1.1-1.1-.49-1.1-1.1.49-1.1 1.1-1.1z" /> </svg> <ic-search-bar slot="search" placeholder="Search" label="Search" ></ic-search-bar> <ic-navigation-button label="Notifications" slot="buttons"> <ic-badge text-label="4" slot="badge" variant="light" position="near" ></ic-badge> <svg slot="icon" xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 0 24 24" width="24" fill="#000000" > <path d="M12 22c1.1 0 2-.9 2-2h-4c0 1.1.89 2 2 2zm6-6v-5c0-3.07-1.64-5.64-4.5-6.32V4c0-.83-.67-1.5-1.5-1.5s-1.5.67-1.5 1.5v.68C7.63 5.36 6 7.92 6 11v5l-2 2v1h16v-1l-2-2z" /> </svg> </ic-navigation-button> <ic-navigation-item slot="navigation" label="Get started" href="#" ></ic-navigation-item> <ic-navigation-item slot="navigation" label="Accessibility" href="#" ></ic-navigation-item> <ic-navigation-item slot="navigation" label="Styles" href="#" ></ic-navigation-item> <ic-navigation-item slot="navigation" label="Components" href="#" selected="true" ></ic-navigation-item> <ic-navigation-item slot="navigation" label="Patterns" href="#" ></ic-navigation-item></ic-top-navigation>
<IcTopNavigation appTitle="ICDS" status="alpha" version="v0.0.7"> <SlottedSVG slot="app-icon" xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 0 24 24" width="24" fill="#000000" > <path d="M0 0h24v24H0V0z" fill="none" /> <path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8zm-5.5-2.5l7.51-3.49L17.5 6.5 9.99 9.99 6.5 17.5zm5.5-6.6c.61 0 1.1.49 1.1 1.1s-.49 1.1-1.1 1.1-1.1-.49-1.1-1.1.49-1.1 1.1-1.1z" /> </SlottedSVG> <IcSearchBar slot="search" placeholder="Search" label="Search" /> <IcNavigationButton label="Notifications" slot="buttons"> <IcBadge textLabel="4" slot="badge" variant="light" position="near" /> <SlottedSVG slot="icon" xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 0 24 24" width="24" fill="#000000" > <path d="M12 22c1.1 0 2-.9 2-2h-4c0 1.1.89 2 2 2zm6-6v-5c0-3.07-1.64-5.64-4.5-6.32V4c0-.83-.67-1.5-1.5-1.5s-1.5.67-1.5 1.5v.68C7.63 5.36 6 7.92 6 11v5l-2 2v1h16v-1l-2-2z" /> </SlottedSVG> </IcNavigationButton> <IcNavigationItem slot="navigation" label="Get started" href="#" /> <IcNavigationItem slot="navigation" label="Accessibility" href="#" /> <IcNavigationItem slot="navigation" label="Styles" href="#" /> <IcNavigationItem slot="navigation" label="Components" href="#" selected /> <IcNavigationItem slot="navigation" label="Patterns" href="#" /></IcTopNavigation>
With short app title
View on a small screen size to display the short title in place of the app title.
Interactive example
<ic-top-navigation app-title="Intelligence Community Design System" short-app-title="ICDS" status="alpha" version="v0.0.7"> <svg slot="app-icon" xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 0 24 24" width="24" fill="#000000" > <path d="M0 0h24v24H0V0z" fill="none" /> <path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8zm-5.5-2.5l7.51-3.49L17.5 6.5 9.99 9.99 6.5 17.5zm5.5-6.6c.61 0 1.1.49 1.1 1.1s-.49 1.1-1.1 1.1-1.1-.49-1.1-1.1.49-1.1 1.1-1.1z" /> </svg> <ic-navigation-item slot="navigation" label="Get started" href="/" ></ic-navigation-item> <ic-navigation-item slot="navigation" label="Accessibility" href="/" ></ic-navigation-item> <ic-navigation-item slot="navigation" label="Styles" href="/" ></ic-navigation-item> <ic-navigation-item slot="navigation" label="Components" href="/" selected="true" ></ic-navigation-item> <ic-navigation-item slot="navigation" label="Patterns" href="/" ></ic-navigation-item></ic-top-navigation>
<IcTopNavigation appTitle="Intelligence Community Design System" shortAppTitle="ICDS" status="alpha" version="v0.0.7"> <SlottedSVG slot="app-icon" xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 0 24 24" width="24" fill="#000000" > <path d="M0 0h24v24H0V0z" fill="none" /> <path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8zm-5.5-2.5l7.51-3.49L17.5 6.5 9.99 9.99 6.5 17.5zm5.5-6.6c.61 0 1.1.49 1.1 1.1s-.49 1.1-1.1 1.1-1.1-.49-1.1-1.1.49-1.1 1.1-1.1z" /> </SlottedSVG> <IcNavigationItem slot="navigation" label="Get started" href="#" /> <IcNavigationItem slot="navigation" label="Accessibility" href="#" /> <IcNavigationItem slot="navigation" label="Styles" href="#" /> <IcNavigationItem slot="navigation" label="Components" href="#" selected /> <IcNavigationItem slot="navigation" label="Patterns" href="#" /></IcTopNavigation>
Conditional tabs
Interactive example
<IcTopNavigation appTitle="ApplicationName" status="alpha" version="v0.0.7"> <SlottedSVG slot="app-icon" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="#000000" > <path d="M0 0h24v24H0V0z" fill="none" /> <path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8zm-5.5-2.5l7.51-3.49L17.5 6.5 9.99 9.99 6.5 17.5zm5.5-6.6c.61 0 1.1.49 1.1 1.1s-.49 1.1-1.1 1.1-1.1-.49-1.1-1.1.49-1.1 1.1-1.1z" /> </SlottedSVG> <IcNavigationItem label="One" href="/" selected slot="navigation" /> <IcNavigationItem label="Two" href="/" slot="navigation" /> <IcNavigationItem label="Three" href="/" slot="navigation" /> {showNavItems && ( <> <IcNavigationItem label="Four" href="/" slot="navigation" /> <IcNavigationItem label="Five" href="/" slot="navigation" /> </> )}</IcTopNavigation>
With React Router (using slots)
The following examples also demonstrate using a slotted link for app title, short app title and app icon.
To guarantee the correct styling for non-svg content slotted into app-icon, set width
, height
and fill
to inherit
.
Interactive example
<MemoryRouter initialEntries={["/"]}> <IcTopNavigation version="v0.0.7"> <NavLink to="/" slot="app-title"> ICDS Title </NavLink> <NavLink to="/" slot="short-app-title"> ICDS </NavLink> <NavLink to="/" slot="app-icon"> <SlottedSVG xmlns="http://www.w3.org/2000/svg" height="inherit" viewBox="0 0 24 24" width="inherit" fill="inherit" > <path d="M0 0h24v24H0V0z" fill="none" /> <path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8zm-5.5-2.5l7.51-3.49L17.5 6.5 9.99 9.99 6.5 17.5zm5.5-6.6c.61 0 1.1.49 1.1 1.1s-.49 1.1-1.1 1.1-1.1-.49-1.1-1.1.49-1.1 1.1-1.1z" /> </SlottedSVG> </NavLink> <IcSearchBar slot="search" placeholder="Search" label="Search" /> <IcNavigationButton label="Test button" slot="buttons" onClick={() => alert("test")} > <SlottedSVG slot="icon" xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 0 24 24" width="24" fill="#000000" > <path d="M0 0h24v24H0V0z" fill="none" /> <path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8zm-5.5-2.5l7.51-3.49L17.5 6.5 9.99 9.99 6.5 17.5zm5.5-6.6c.61 0 1.1.49 1.1 1.1s-.49 1.1-1.1 1.1-1.1-.49-1.1-1.1.49-1.1 1.1-1.1z" /> </SlottedSVG> </IcNavigationButton> <IcNavigationItem slot="navigation"> <NavLink to="/" slot="navigation-item"> Get started </NavLink> </IcNavigationItem> <IcNavigationItem slot="navigation"> <NavLink to="/accessibility" slot="navigation-item"> Accessibility </NavLink> </IcNavigationItem> </IcTopNavigation> <main> <IcSectionContainer className={classes.sectionContainer}> <Routes> <Route path="/" element={ <IcTypography>This is the get started page</IcTypography> } /> <Route path="/accessibility" element={ <IcTypography>This page is about accessibility</IcTypography> } /> </Routes> </IcSectionContainer> </main></MemoryRouter>
Layout example
For full screen examples, see