UNav Header
The <nys-unavheader> is a reusable web component for use in New York State digital products. It helps provide users with a small NYS-branded header at the top of every page to ensure users they are on a secure NYS site.
Note: The Universal Navigation Header remains consistent across all sites. It also carries the built-in statewide alert, which lets New York State deliver an urgent message to every NYS site at once.
The <nys-unavheader> should only be used on official NYS websites or applications that are hosted on a ny.gov domain and secured with HTTPS encryption. Intranets and back office applications are not currently required to use the <nys-unavheader>.
Please refer to the New York State Universal Web Navigation Policy (NYS-S16-001) for more details.
<nys-unavheader></nys-unavheader>
Can't use NYS Design System web components in your project? Try using the CSS Variables instead.
Accessibility
The <nys-unavheader> component includes the following accessibility-focused features:
-
Proper use of
<header>and<a>elements ensures compatibility with assistive technologies. -
Keyboard navigation: Users can tab through all links in the header.
-
Statewide alerts inherit the accessibility of
<nys-alert>, and their links accept anaria-labelfrom the feed when the visible label is not descriptive on its own.Additional accessibility test and build content is coming soon, in a new format.
Options
Search Off
<nys-unavheader hideSearch></nys-unavheader>
Custom Search Endpoint
The default search URL for the <nys-unavheader> is https://search.its.ny.gov/search/search.html?q=. The searchUrl property allows you to override the search endpoint with a custom url.
<nys-unavheader searchUrl="https://designsystem.ny.gov/search/?q=" hideTranslate></nys-unavheader>
Translate Off
<nys-unavheader hideTranslate></nys-unavheader>
Custom Language Endpoints
By default, the translate feature utilizes Smartling, which reroutes the page to the same URL with the language code prepended (e.g. https://www.ny.gov/ becomes https://es.ny.gov/). If your site does not use Smartling, you can override the default translate behavior to function with your translation service.
You also can override the default list of languages offered if your translation service does not support all of the default languages.
<nys-unavheader id="my-header"></nys-unavheader>
<script>
const header = document.querySelector('#my-header');
header.languages = [
{ code: 'en', label: 'English' },
{ code: 'es', label: 'Español' , url: '"https://ny.gov/?lang=es"'},
{ code: 'fr', label: 'Français', url: '"https://ny.gov/?lang=fr"'},
];
</script>
You also can override the default translate behavior to work with JavaScript rather than rerouting the URL. This allows you to implement a custom translation solution that does not require page reroutes.
<nys-unavheader id="my-header2" hideSearch></nys-unavheader>
<script>
document.querySelector('#my-header2').addEventListener('nys-language-select', (event) => {
event.preventDefault();
const selectedLanguage = event.detail.language.label;
alert(`Language changed to: ${selectedLanguage}`);
});
</script>
Statewide Alerts
When New York State publishes an urgent message, such as a severe weather event or a public health emergency, the header renders it as a full-width banner directly below the header content. This is not configurable: on page load, the header reads the statewide alert feed at https://alerts-cta.static-assets.ny.gov/alerts.json and renders whatever is currently published. There is no property, slot, or script to add, and sites never author the content, so the same message reads identically everywhere it appears. If nothing is published or the feed cannot be reached, the header renders normally.
Usage
Do
- Place at the top of every public-facing page.
- Toggle search (
hideSearch) and translate (hideTranslate) on/off depending on your needs. - Design your page so content below the header can shift down, since a statewide alert can appear at any time and adds height to the header.
Don't
- Use on back office applications or internal sites that are not public-facing, instead use the
<nys-globalheader>with thenysLogoproperty applied. - Place anywhere other than the top of the page.
- Modify the universal header.
Properties
| Property | Type | Default |
|---|---|---|
searchUrl |
String | "" |
hideSearch |
boolean | false |
hideTranslate |
boolean | false |
Style Overrides
These CSS custom properties are exposed for developers to customize the visual appearance of the component when necessary, beyond the defaults provided by the NYS Design System. Set them on the component selector to override the default styles.
| CSS Variable | Description |
|---|---|
--_nys-unavheader-max-width--content |
The maximum width of the inner main content area. Use this only to align header, footer, or breadcrumb components with the main page content when needed. |
| Can't find a property you need? Explore existing options, or propose a new one with a Component Proposal. | |
Events
This component emits two custom Javascript events:
-
nys-language-select- Emitted when a user selects a language from the translate dropdown. The event detail contains the selected language object. -
nys-search-submit- Emitted when a user submits a search query. The event detail contains the search query string.
Suggest a New Component
Do you have an idea for a new NYS Design System web component? Look through the existing proposals in our GitHub discussions board to see if someone already proposed something similar. If not, feel free to submit one.
Edit this page on GitHub (Permissions required)
Last updated: August 13, 2026