Panels
- HTML/CSS:Dev Ready
- Layout:Desktop Only
Sections
Panel Header
About Panel#
A panel is docked to the left/right side of a viewport and is in the document flow of the canvas or main content.
Use this component when:
- The canvas content extends beyond the boundaries of the viewport, while panning and zooming is supported
- It is not important to see canvas content while completing the task in a Panel
- The task performed in a Panel is momentary
Toggling visibility of a Panel will re-flow the main content.
The panel should take up 100% of the height of its parent container. In most cases, that would be the viewport or main stage of your application.
Implementation Note
The panel blueprint does not have an opinion about your app's layout. It is up to you to add the panel to your project's structure while adhering to our guidelines. For example, the visibility section showcases a panel implemented within a demo container using a
flex
layout.
Accessibility#
When managing the visibility of the panel, there are a few essential accessibility elements to make sure are in place:
- When the panel is not visible, set its
aria-hidden
attribute totrue
, and when visible, setaria-hidden
tofalse
. - If the panel's visibility is triggered by an element, the triggering element must be focusable with
aria-controls
set to the unique ID of the panel andaria-expanded
set to eithertrue
orfalse
depending on the visibility of the panel. - When toggling a panel open, place the user's focus inside the first focusable element within the panel that isn't the close button. If the close button is the only focusable element, place focus there. Return focus to the triggering element when the panel closes.
Base#
Panel Header
<div class="slds-panel slds-size_medium slds-panel_docked slds-panel_docked-left slds-is-open">
<div class="slds-panel__header">
<h2 class="slds-panel__header-title slds-text-heading_small slds-truncate" title="Panel Header">Panel Header</h2>
<div class="slds-panel__header-actions">
Header#
The header is docked to the top of its panel. When the content of the panel body becomes overflowed, the body will provide scrolling while the header remains visible in place.
The header of a left/right docked panel has left-aligned text by default and one icon that dismisses the panel. The header title should truncate when it becomes too long for the panel width by using the slds-truncate
class on the title.
Panel Header
<div class="slds-panel slds-size_medium slds-panel_docked slds-panel_docked-left slds-is-open">
<div class="slds-panel__header">
<h2 class="slds-panel__header-title slds-text-heading_small slds-truncate" title="Panel Header">Panel Header</h2>
<div class="slds-panel__header-actions">
Centered Text#
To center the header title, add the class slds-panel__header_align-center
to the <div>
with class slds-panel__header
.
Panel Header
<div class="slds-panel slds-size_medium slds-panel_docked slds-panel_docked-left slds-is-open">
<div class="slds-panel__header slds-panel__header_align-center">
<h2 class="slds-panel__header-title slds-text-heading_small slds-truncate" title="Panel Header">Panel Header</h2>
<div class="slds-panel__header-actions">
Secondary Actions#
Secondary actions provide a compact way to offer additional actions without the need for a dedicated action toolbar. Actions in the menu apply to the entire component.
Accessibility Requirement
Secondary actions use the menu component. All of the accessibility guidelines for the menu component are pertinent within the context of secondary actions.
Panel Header
<div class="slds-panel slds-size_medium slds-panel_docked slds-panel_docked-left slds-is-open">
<div class="slds-panel__header">
<h2 class="slds-panel__header-title slds-text-heading_small slds-truncate" title="Panel Header">Panel Header</h2>
<div class="slds-panel__header-actions">
Custom Header#
If a panel header requires additional elements outside of a title and close button, The panel header needs to have the class slds-panel__header_custom
added to slds-panel__header
. This notifies the component that it has a custom layout in the header.
<div class="slds-panel__header slds-panel__header_custom">...</div>
The h2
which contains the title of the panel requires the class slds-panel__header-title
.
Invoked via Toggle#
Accessibility Requirement
When toggling the visibility, author must manage user focus by placing the user inside the panel when it opens and returning them to the trigger when it closes.
Positioning#
The slds-panel_docked
element can be positioned on the left or right side of a viewport by adding the class slds-panel_docked-left
or slds-panel_docked-right
.
Left side#
Panel Header
<div class="slds-panel slds-size_medium slds-panel_docked slds-panel_docked-left slds-is-open">
<div class="slds-panel__header">
<h2 class="slds-panel__header-title slds-text-heading_small slds-truncate" title="Panel Header">Panel Header</h2>
<div class="slds-panel__header-actions">
Right side#
Panel Header
<div class="slds-panel slds-size_medium slds-panel_docked slds-panel_docked-right slds-is-open">
<div class="slds-panel__header">
<h2 class="slds-panel__header-title slds-text-heading_small slds-truncate" title="Panel Header">Panel Header</h2>
<div class="slds-panel__header-actions">
Drilled-In State#
Design Note
If the panel has been drilled into, then the panel displays an arrow facing to the left to indicate the direction the user drilled in from.
Accessibility Requirement
When the user drills in, the author must manage user focus by keeping the user inside the panel when it drills in and returning them to the drill-in trigger when it the user presses the back arrow.
Positioning#
Left side#
Panel Header
<div class="slds-panel slds-size_medium slds-panel_docked slds-panel_docked-left slds-is-open">
<div class="slds-panel__header">
<button class="slds-button slds-button_icon slds-button_icon-small slds-panel__back" title="Collapse Panel Header">
<svg class="slds-button__icon" aria-hidden="true">
Right side#
Panel Header
<div class="slds-panel slds-size_medium slds-panel_docked slds-panel_docked-right slds-is-open">
<div class="slds-panel__header">
<button class="slds-button slds-button_icon slds-button_icon-small slds-panel__back" title="Collapse Panel Header">
<svg class="slds-button__icon" aria-hidden="true">
Sizing#
The panel width can be modified by applying a sizing class to the slds-panel
element.
The panels come in 5 different sizes:
Width | SLDS Class |
---|---|
240px | slds-size_small |
320px | slds-size_medium |
400px | slds-size_large |
640px | slds-size_x-large |
100% | slds-size_full |
Panel Visibility#
Open as a drawer#
A panel causes reflow by being in the flow of the layout rather than overlaid on top of the content. To achieve this, simply toggle the class slds-is-open
to the slds-panel_docked
element.
Panel Header
<header class="demo-only-element slds-theme_default slds-border_bottom slds-p-around_small" style="z-index:1">
<button class="slds-button slds-button_icon slds-is-selected slds-button_icon-border-filled slds-button_icon-border" title="Toggle panel" aria-expanded="true" aria-controls="example-unique-id-3" aria-pressed="true">
<svg class="slds-button__icon" aria-hidden="true">
<use xlink:href="/assets/icons/utility-sprite/svg/symbols.svg#toggle_panel_left"></use>
Panels for Filtering#
Filtering lists or reports can be done by using a Filtering expressions inside of a Panel. Check out the Filtering expression component for different states and accessibility requirements.
Accessibility Requirement
Make sure to use assistive text to improve the clarity of what you might be editing, for example, add
<span className="slds-assistive-text">Edit filter:</span>
to the button element inside each filterable object.
Filter
Matching all these filters
<header class="demo-only-element slds-theme_default slds-border_bottom slds-p-around_small slds-text-align_right" style="z-index:1">
<button class="slds-button slds-button_icon slds-is-selected slds-button_icon-border-filled slds-button_icon-border" title="Toggle filter panel" aria-expanded="true" aria-controls="example-unique-id-6" aria-pressed="true">
<svg class="slds-button__icon" aria-hidden="true">
<use xlink:href="/assets/icons/utility-sprite/svg/symbols.svg#filterList"></use>
Overview of CSS Classes#
- Selector
- The CSS class being referred to.
- Summary
- A description of what the class does.
- Support
- Whether the class name is dev-ready (meaning it's fully vetted and tested and safe to use) or prototype (which means it's not fully vetted yet).
- Restrict
- The selector that the class name is allowed to be used on.
- Variant
- The base level pattern for a component. A variant can be extended to create another variant of that component, for example, a stateful button is a derivative of the base button.
- Modifier
- A single class that can be added to an HTML element of a component to modify its output. Typically these will be colors, sizing and positioning.
Selector | .slds-panel |
---|---|
Summary | Panel component |
Support | dev-ready |
Restrict | div |
Variant | True |
Selector | .slds-panel__section |
---|---|
Summary | Contains sub sections of a panel |
Restrict | .slds-panel div |
Selector | .slds-panel__actions |
---|---|
Summary | Contains form actions at the bottom of a panel |
Restrict | .slds-panel div |
Selector | .slds-panel__header |
---|---|
Summary | Header element of a panel |
Restrict | .slds-panel div |
Selector | .slds-panel__header_custom |
---|---|
Summary | Modifier that notifies panel header that something other than a title and close button exist |
Restrict | .slds-panel__header |
Modifier | True |
Selector | .slds-panel__header_align-center |
---|---|
Summary | Adjusts styling when the title of the header is centered |
Restrict | .slds-panel__header |
Modifier | True |
Selector | .slds-panel__header-actions |
---|---|
Summary | Container for secondary actions that affect the entire panel |
Restrict | .slds-panel__header div |
Selector | .slds-panel__header-title |
---|---|
Summary | Title of the header panel |
Restrict | .slds-panel__header h2 |
Selector | .slds-panel__close |
---|---|
Summary | Close button of a panel |
Restrict | .slds-panel .slds-button |
Selector | .slds-panel__back |
---|---|
Summary | Back button of a panel drilled in |
Restrict | .slds-panel .slds-button |
Selector | .slds-panel__body |
---|---|
Summary | Body element of a panel |
Restrict | .slds-panel div |
Selector | .slds-panel_docked |
---|---|
Summary | Modifier that changes the display of a panel to dock to the viewport |
Restrict | .slds-panel |
Modifier | True |
Selector | .slds-is-open |
---|---|
Summary | Toggles visibility of panel |
Restrict | .slds-panel_docked |
Selector | .slds-panel_docked-left |
---|---|
Summary | Modifier that changes the position of a panel to the left |
Restrict | .slds-panel_docked |
Modifier | True |
Selector | .slds-panel_docked-right |
---|---|
Summary | Modifier that changes the position of a panel to the right |
Restrict | .slds-panel_docked |
Modifier | True |
Selector | .slds-panel_filters |
---|---|
Summary | |
Support | dev-ready |
Restrict | .slds-panel |
Variant | True |
Panels Release Notes
2.22.0
Changed
- Replaced aria-hidden with hidden attribute for components that show/hide content
2.15.7
Added
- Added
aria-pressed
attribute to Panel toggle button
2.15.0
Added
- Added a new element,
.slds-panel__header-actions
, within the panel header to hold secondary actions that affect the entire panel. You can find the close button within the new element. - Added an example of the new secondary actions element that contains an overflow menu with actions.
- Added additional demo elements to the panels for filtering example: top bar with accompanying button icon (
filterList
) that toggles the panel with filtering content, two-column content layout, and panel toggling behavior. - Added
aria-expanded
andaria-controls
to the button that toggles the panel.
Changed
- Updated the icon in the open as a drawer example from
filterList
totoggle_panel_left
. The new icon better represents the action evoked by the button icon. - Updated the icon in drilled-in state example that takes you back to the previous panel from
back
tochevronleft
. This update makes the icon consistent between drilled-in states.
2.7.0
Changed
- Updated panel headers to have left aligned text by default. To center the header title, use the class
slds-panel__header_align-center
. - Updated
slds-panel_body
padding to be 0.75rem around instead of 1rem. - Updated our documentation to reflect that panels always have a close button, but may also have a back button if panel was invoked by drilling in.
Fixed
- Forced panel buttons to keep their square shape by preventing
flex-shrink
.