Component Blueprints

Global Header

The global header is the anchor for the Salesforce platform and spans all other parts of the UI. The functionality in the header is applicable across all contexts in the Salesforce ecosystem (internal or 3rd party).
Skip to NavigationSkip to Main Content

About Global Header#

Structure#

The global header is made up of 3 distinct sections, the logo, the global search, and the global actions. Each section is wrapped in a <div> with the class name slds-global-header__item. The search region gets the modifier class slds-global-header__item_search. This class provides particular styling to handle the search box.

<header class="slds-global-header_container">
  <div class="slds-global-header">
    <div class="slds-global-header__item">...</div>
    <div class="slds-global-header__item slds-global-header__item_search">...</div>

In most scenarios, you will want to fix the global header to the top of the viewport. To achieve this, wrap the global header component in a <div> with the class name slds-global-header_container.

<header class="slds-global-header_container">
  <div class="slds-global-header">...</div>
</header>

Accessibility#

For screen reading users, we need to provide a way to navigate over the global header and directly to content regions. For this scenario, we provide two links above the global header that provides navigation to landmarks within the app. These links are visually hidden by default but become visible when focused.

<header class="slds-global-header_container">
  <a href="#" class="slds-assistive-text slds-assistive-text_focus">Skip to Navigation</a>
  <a href="#" class="slds-assistive-text slds-assistive-text_focus">Skip to Main Content</a>
  <div class="slds-global-header">...</div>

Base#

Skip to NavigationSkip to Main Content
<header class="slds-global-header_container">
  <a href="#" class="slds-assistive-text slds-assistive-text_focus">Skip to Navigation</a>
  <a href="#" class="slds-assistive-text slds-assistive-text_focus">Skip to Main Content</a>
  <div class="slds-global-header slds-grid slds-grid_align-spread">

The logo region is a <div> with the class name slds-global-header__logo wrapped around a span with assistive text for the logo. This inner span has the class name slds-assistive-text and is required to meet accessibility guidelines. The logo is applied as a background image to the div with CSS. This allows us to constrain the dimensions of the logo by a max-height of 40px and a max-width of 200px.

<div class="slds-global-header__item">
  <div class="slds-global-header__logo">
    <span class="slds-assistive-text">Salesforce</span>
  </div>
</div>

The global search component is used for application wide search. The form element is implemented as a Combobox, please refer to the accessibility guidelines on the Combobox component page for implementation guidance.

Default#

Skip to NavigationSkip to Main Content
<header class="slds-global-header_container">
  <a href="#" class="slds-assistive-text slds-assistive-text_focus">Skip to Navigation</a>
  <a href="#" class="slds-assistive-text slds-assistive-text_focus">Skip to Main Content</a>
  <div class="slds-global-header slds-grid slds-grid_align-spread">

Focused and expanded#

Skip to NavigationSkip to Main Content
<header class="slds-global-header_container">
  <a href="#" class="slds-assistive-text slds-assistive-text_focus">Skip to Navigation</a>
  <a href="#" class="slds-assistive-text slds-assistive-text_focus">Skip to Main Content</a>
  <div class="slds-global-header slds-grid slds-grid_align-spread">

Active and typing#

Skip to NavigationSkip to Main Content
<header class="slds-global-header_container">
  <a href="#" class="slds-assistive-text slds-assistive-text_focus">Skip to Navigation</a>
  <a href="#" class="slds-assistive-text slds-assistive-text_focus">Skip to Main Content</a>
  <div class="slds-global-header slds-grid slds-grid_align-spread">

Global Actions Bar#

The global actions bar holds application wide task actions that will persist with the user through their experience.

The global actions bar is located in the right region of the global header.

Skip to NavigationSkip to Main Content

Favorites#

The favorites action is used to "favorite" a commonly used page within a user's experience. When a user "favorites" a page by pressing the favorites action, the button icon changes color with a small animation to confirm your selection.

Not pressed#

<ul class="slds-global-actions">
  <li class="slds-global-actions__item">
    <div class="slds-global-actions__favorites slds-dropdown-trigger slds-dropdown-trigger_click">
      <div class="slds-button-group">

Pressed#

When pressed, apply the class slds-is-selected to the slds-global-actions__favorites-action button element.

Accessibility Requirement

When the favorites action is pressed, we need to toggle the aria-pressed attribute to true. This will inform a screen reader that the button has been pressed.

<ul class="slds-global-actions">
  <li class="slds-global-actions__item">
    <div class="slds-global-actions__favorites slds-dropdown-trigger slds-dropdown-trigger_click">
      <div class="slds-button-group">

Disabled#

If the favorites action needs to become disabled, apply the disabled attribute and the class slds-is-disabled to the button with class="slds-global-actions_favorites-action".

<ul class="slds-global-actions">
  <li class="slds-global-actions__item">
    <div class="slds-global-actions__favorites slds-dropdown-trigger slds-dropdown-trigger_click">
      <div class="slds-button-group">

Favorites popover#

The favorites popover is invoked when a user clicks on the dropdown arrow action icon inside of the favorites button group. The favorites popover is implemented as a Popover - Dynamic Menu Variant component, please refer to the accessibility guidelines on the Popover component page for implementation guidance.

<ul class="slds-global-actions">
  <li class="slds-global-actions__item">
    <div class="slds-global-actions__favorites slds-dropdown-trigger slds-dropdown-trigger_click">
      <div class="slds-button-group">

Task#

<ul class="slds-global-actions">
  <li class="slds-global-actions__item">
    <div class="slds-dropdown-trigger slds-dropdown-trigger_click">
      <button class="slds-button slds-button_icon slds-button_icon slds-button_icon-container slds-button_icon-small slds-global-actions__task slds-global-actions__item-action" aria-haspopup="true" title="Global Actions">

Task menu#

When the global task action is invoked, a menu inside of a dropdown becomes visible. Please refer to the accessibility section of the Menus component for implementation guidelines.

<ul class="slds-global-actions">
  <li class="slds-global-actions__item">
    <div class="slds-global-actions__favorites slds-dropdown-trigger slds-dropdown-trigger_click">
      <div class="slds-button-group">

Help#

<ul class="slds-global-actions">
  <li class="slds-global-actions__item">
    <div class="slds-dropdown-trigger slds-dropdown-trigger_click">
      <button class="slds-button slds-button_icon slds-button_icon slds-button_icon-container slds-button_icon-small slds-global-actions__help slds-global-actions__item-action" aria-haspopup="true" title="Help and Training">

Setup#

<ul class="slds-global-actions">
  <li class="slds-global-actions__item">
    <div class="slds-dropdown-trigger slds-dropdown-trigger_click">
      <button class="slds-button slds-button_icon slds-button_icon slds-button_icon-container slds-button_icon-small slds-global-actions__setup slds-global-actions__item-action" aria-haspopup="true" title="Setup">

Notifications#

Notifications are a way to notify a user about a global change within the application. This is commonly used to communicate a Chatter mention/reply or a status update on an opportunity pipeline.

Skip to NavigationSkip to Main Content

No notifications#

<ul class="slds-global-actions">
  <li class="slds-global-actions__item">
    <div class="slds-dropdown-trigger slds-dropdown-trigger_click">
      <button class="slds-button slds-button_icon slds-button_icon slds-button_icon-container slds-button_icon-small slds-global-actions__notifications slds-global-actions__item-action" title="no new notifications" aria-live="assertive" aria-atomic="true">

New notifications#

When a notification is coming through, we want to apply the slds-incoming-notification class to both the slds-global-actions__notifications button, as well as the slds-notification-badge. This will initiate the animation that there is a new incoming notification. A notification badge will also need to receive the slds-show-notification class, this ensures the badge becomes visible for the incoming animation to work. The slds-show-notification class should also be applied if a user has unread notifications upon their return to their application.

Accessibility Note

The notification badge is hidden from screen readers by add the attribute aria-hidden="true" so the badge doesn't have to be inside the button itself. Since the badge count is hidden, we need to add the count number to the button text via some hidden assistive text. The assistive text string should be updated with number of new notifications, such as "3 new notification". If there are no notifications, the assistive text should read "No notifications". The button element also requires aria-live="assertive" to announce any count updates.

<ul class="slds-global-actions">
  <li class="slds-global-actions__item">
    <div class="slds-dropdown-trigger slds-dropdown-trigger_click">
      <button class="slds-button slds-button_icon slds-button_icon slds-button_icon-container slds-button_icon-small slds-global-actions__notifications slds-global-actions__item-action slds-incoming-notification" title="1 new notifications" aria-live="assertive"

Notification Popover#

The notification popover is invoked when a user clicks on the notification action icon. The notification popover is implemented as a Popover component, please refer to the accessibility guidelines on the Popover component page for implementation guidance.

<section aria-describedby="dialog-body-id-6" aria-labelledby="dialog-heading-id-6" class="slds-popover slds-popover_large slds-nubbin_top-right" role="dialog" style="position:absolute;top:calc(100% + 12px);right:-12px">
  <button class="slds-button slds-button_icon slds-button_icon-small slds-float_right slds-popover__close" title="Close dialog">
    <svg class="slds-button__icon" aria-hidden="true">
      <use xlink:href="/assets/icons/utility-sprite/svg/symbols.svg#close"></use>

Unread notifications#

When a notification item is unread, add the class slds-global-header__notification_unread to the slds-global-header__notification list item. This will provide the unread styles. In addition to adding the class name, please add a dot indicator, <abbr class="slds-text-link slds-m-horizontal_xxx-small" title="unread">●</abbr>, to provide visual affordance that the item is unread.

Overview of CSS Classes#

Selector.slds-global-header_container
Summary

Container that fixes the global header to the top of the viewport, contains global header element

Supportdev-ready
Restrictheader
VariantTrue
Selector.slds-global-header
Summary
Restrict.slds-global-header_container div
Selector.slds-global-header__item
Summary

A region within the global header

Restrict.slds-global-header div, .slds-global-header ul
Selector.slds-global-header__button_icon-actionsDeprecated
Summary

Button icon specifically for global actions

Restrict.slds-global-header__item button
Selector.global-header__iconDeprecated
Summary

Deal with sizing for global header icons

Restrict.slds-global-header__item svg
Selector.slds-global-header__button_icon-favoritesDeprecated
Summary

Button icon specifically for global actions

Restrict.slds-global-header__item button
Selector.slds-is-selectedDeprecated
Summary

Selected state for favorites button

Restrict.slds-global-header__button_icon-favorites
Selector.slds-is-disabledDeprecated
Summary

Disabled state for favorites button

Restrict.slds-global-header__button_icon-favorites
Selector.slds-global-header__button_iconDeprecated
Summary

Button icons on the global header

Restrict.slds-global-header__item button
Selector.slds-global-header__logo
Summary

Container of the global header logo

Restrict.slds-global-header__item div
Selector.slds-global-header__item_search
Summary

Region that contains the search input, handles sizing

Restrict.slds-global-header__item:nth-child(2)
Selector.slds-global-search__form-element div
Summary

Primary combobox that contains the search input, handles sizing

Restrict.slds-global-header__item_search
Selector.slds-listbox_selection-group
Summary

The container of pill selections found inside of a combobox group

Restrict.slds-combobox-group ~ div, .slds-combobox_container ~ div
Selector.slds-listbox
Summary

Listbox container

Supportdev-ready
Restrict.slds-dropdown ul, .slds-dueling-list__options ul, .slds-pill_container ul, .slds-listbox_selection-group ul, .slds-combobox_container ul, .slds-form-element__control ul, .slds-popover__body ul
VariantTrue
Selector.slds-listbox_inline
Summary

Inline listbox

Restrict.slds-listbox
ModifierTrue
Selector.slds-listbox_horizontal
Summary

Horizontal listbox

Restrict.slds-listbox
ModifierTrue
Selector.slds-listbox__item
Summary

Listbox item

Restrict.slds-listbox > li
Selector.slds-listbox__option
Summary

Choosable option within listbox

Restrict.slds-listbox__item > div
Selector.slds-listbox__option-header
Summary

Header for choosable option within listbox

Restrict.slds-listbox__option h3
Selector.slds-listbox__option-icon
Summary

Container for listbox option icon

Restrict.slds-listbox__option span
Selector.slds-has-focus
Summary

Focus state of a vertical listbox option

Restrict.slds-listbox__option
ModifierTrue
Selector.slds-listbox__option_entity
Summary

Modifies the listbox option if it contains an entity object

Restrict.slds-listbox__option
Selector.slds-listbox__option_plain
Summary

Modifies the listbox option if it contains an plain object or string

Restrict.slds-listbox__option
Selector.slds-listbox__option_has-meta
Summary

If the listbox option has metadata or secondary information that sits below its primary text

Restrict.slds-listbox__option
Selector.slds-is-selected
Summary

Modifier that makes selected icon visible

Restrict.slds-listbox__option
ModifierTrue
Selector.slds-listbox__option-text_entity
Summary

The main text of an entity listbox

Restrict.slds-listbox__option span
Selector.slds-listbox__option-meta
Summary

The metadata or secondary text of an entity listbox

Restrict.slds-listbox__option span
Selector.slds-listbox__icon-selected
Summary

The icon within a plain listbox that indicates if an option has been selected or not.

Restrict.slds-listbox__item svg
Selector.slds-listbox_vertical
Summary

Creates a vertical listbox

Restrict.slds-listbox
ModifierTrue
Selector.slds-dropdown_length-5
Summary

Forces overflow scrolling after 5 list items

Restrict.slds-dropdown, .slds-dropdown__list, .slds-listbox
ModifierTrue
Selector.slds-dropdown_length-7
Summary

Forces overflow scrolling after 7 list items

Restrict.slds-dropdown, .slds-dropdown__list, .slds-listbox
ModifierTrue
Selector.slds-dropdown_length-10
Summary

Forces overflow scrolling after 10 list items

Restrict.slds-dropdown, .slds-dropdown__list, .slds-listbox
ModifierTrue
Selector.slds-dropdown_length-with-icon-5
Summary

Forces overflow scrolling after 5 list items with an icon

Restrict.slds-dropdown, .slds-dropdown__list, .slds-listbox
ModifierTrue
Selector.slds-dropdown_length-with-icon-7
Summary

Forces overflow scrolling after 7 list items with an icon

Restrict.slds-dropdown, .slds-dropdown__list, .slds-listbox
ModifierTrue
Selector.slds-dropdown_length-with-icon-10
Summary

Forces overflow scrolling after 10 list items with an icon

Restrict.slds-dropdown, .slds-dropdown__list, .slds-listbox
ModifierTrue
Selector.slds-is-expanded
Summary

Expanded state of a selection group

Restrict.slds-listbox_selection-group
Selector.slds-listbox-toggle
Summary

Toggle button to show all of the pill selections

Restrict.slds-listbox_selection-group > span
Selector.slds-backdrop
Summary

Creates the shaded backdrop used behind the modal.

Restrict.slds-modal ~ div
Selector.slds-backdrop_open
Summary

Allows the backdrop to be visible.

Restrict.slds-backdrop
ModifierTrue
Selector.slds-global-actions
Summary

Global actions component wrapper

Restrict.slds-global-header ul
Selector.slds-global-actions__item
Summary

List item for each global action

Restrict.slds-global-actions li
Selector.slds-global-actions__item-action
Summary

The actionable button inside of a global actions list item

Restrict.slds-global-actions__item button
Selector.slds-global-actions__avatar
Summary

User profile action icon

Restrict.slds-global-actions__item-action
Selector.slds-global-actions__task
Summary

Task action icon

Restrict.slds-global-actions__item-action
Selector.slds-global-actions__notifications
Summary

Notification action icon

Restrict.slds-global-actions__item-action
Selector.slds-global-actions__favorites
Summary

Favorites action button group

Restrict.slds-global-actions__item div
Selector.slds-global-actions__favorites-action
Summary

Star icon inside of favorites button group

Restrict.slds-global-actions__favorites button
Selector.slds-is-selected
Summary

Selected/clicked state on favorites button

Restrict.slds-global-actions__favorites-action
Selector.slds-is-disabled
Summary

Disabled state on favorites button

Restrict.slds-global-actions__favorites-action
Selector.slds-global-actions__favorites-more
Summary

More dropdown icon inside of favorites button group

Restrict.slds-global-actions__favorites button
Selector.slds-notification-badge
Summary

Notification counter badge

Restrict.slds-global-actions__item span

Global Header Release Notes

2.19

Fixed

  • Fixed hardcoded base global header logo image path

2.12.3

Changed

  • Added assistive text for the logo.

2.8.0

Removed

  • Removed slds-text-title_caps from menu headers.

2.7.0

Changed

  • Changed Salesforce logo image path.