Progress Indicator
- HTML/CSS:Dev Ready
- Layout:Responsive
Sections
About Progress Indicator#
Implementation Requirements#
The slds-progress-bar
accepts a range from 0% to 100%, and this percentage should be applied with inline styling to the div
with class slds-progress-bar__value
using JavaScript. If implementing a horizontal progress indicator, set the width, otherwise set the height for vertical progress indicators.
Accessibility#
As the percentage of completion changes, be sure to update the aria-valuenow
property on the <div>
with class="slds-progress-bar"
, as well as the slds-assistive-text
<span>
.
<div class="slds-progress-bar slds-progress-bar_x-small" aria-valuemin="0" aria-valuemax="100" aria-valuenow="50" role="progressbar">
<span class="slds-progress-bar__value" style="width:50%">
<span class="slds-assistive-text">Progress: 50%</span>
</span>
</div>
Mobile#
On mobile devices, such as phones and other devices that have touch as the primary method of interaction, progress indicators will have increased actionable area sizes to accommodate tapping with a finger instead of the more precise mouse cursor.
Below is a live example of what to expect in that context. No code changes are needed in the Salesforce platform context as this change occurs automatically in Salesforce native mobile applications. For those users not on the Salesforce platform, these modifications will occur automatically when the secondary touch stylesheet is loaded and the device has touch as the primary method of interaction.
Base#
<div class="slds-progress">
<ol class="slds-progress__list">
<li class="slds-progress__item slds-is-active">
<button class="slds-button slds-progress__marker">
Horizontal#
Active Step#
When a step becomes active, the <div>
with class .slds-progress__item
should also get the class .slds-is-active
.
Accessibility Requirements
When a step is active, be sure to append "- Active" to the hidden button text in the
<span>
with classslds-assistive-text
, such asStep 1 - Active
.
<div class="slds-progress">
<ol class="slds-progress__list">
<li class="slds-progress__item slds-is-active">
<button class="slds-button slds-progress__marker">
Completed Step#
When the step is completed, the .slds-is-active
class should be replaced with the class .slds-is-completed
on .slds-progress__item
. At that point, the .slds-progress__item
element will receive a "success" icon, providing feedback that the step has been completed.
Accessibility Requirements
When a step is completed, be sure to append "- Completed" to the hidden button text in the
<span>
with classslds-assistive-text
, such asStep 2 - Completed
.
<div class="slds-progress">
<ol class="slds-progress__list">
<li class="slds-progress__item slds-is-completed">
<button class="slds-button slds-button_icon slds-progress__marker slds-progress__marker_icon" title="Step 1 - Completed">
Error in a Step#
When an error has occurred on a step, the <div>
with class .slds-progress__item
should also get the class .slds-has-error
.
Accessibility Requirements
When a step has an error, be sure to append "- Error" to the hidden button text in the
<span>
with classslds-assistive-text
, such asStep 3 - Error
.
<div class="slds-progress">
<ol class="slds-progress__list">
<li class="slds-progress__item slds-is-completed">
<button class="slds-button slds-button_icon slds-progress__marker slds-progress__marker_icon" title="Step 1 - Completed">
Step Title Tooltip#
Accessibility Requirements
When a step's tooltip is visible, the step's button needs the
aria-describedby
attribute, whose value should be theid
of the associated tooltip.
<div style="padding:3.5rem 1rem 0">
<div class="slds-progress">
<ol class="slds-progress__list">
<li class="slds-progress__item slds-is-completed">
In a Modal#
Modal header
<div>
<section role="dialog" tabindex="-1" aria-modal="true" aria-labelledby="header43" class="slds-modal slds-fade-in-open slds-modal_large">
<div class="slds-modal__container">
<button class="slds-button slds-button_icon slds-modal__close slds-button_icon-inverse">
On a Gray Background#
<div class="slds-progress slds-progress_shade">
<ol class="slds-progress__list">
<li class="slds-progress__item slds-is-completed">
<button class="slds-button slds-button_icon slds-progress__marker slds-progress__marker_icon" title="Step 1 - Completed">
Vertical#
To display a vertical progress indicator, the <div>
with class .slds-progress
should also get the class .slds-progress_vertical
. The vertical progress indicator will take up 100% of the height of its container. The step titles in the vertical variant appear next to the step, instead of in a tooltip.
Implementation Note
The key markup difference between the horizontal and vertical variants is the progress markers. Horizontal progress indicators use
<button>
for each step, whereas Vertical progress indicator steps are not interactive and therefore simply use<div>
.
- CompleteStep 1
- ActiveStep 2
- Step 3
- Step 4
- Step 5
<div class="slds-progress slds-progress_vertical">
<ol class="slds-progress__list">
<li class="slds-progress__item slds-is-completed">
<span class="slds-icon_container slds-icon-utility-success slds-progress__marker slds-progress__marker_icon" title="Complete">
Green Success#
To create a green completed step, the .slds-progress__item
element should also receive the .slds-is-completed
class. In addition, the <span>
with class .slds-progress__marker_icon
should also get the class slds-progress__marker_icon-success
.
- CompleteStep 1
- ActiveStep 2
- Step 3
- Step 4
- Step 5
<div class="slds-progress slds-progress_vertical">
<ol class="slds-progress__list">
<li class="slds-progress__item slds-is-completed">
<span class="slds-icon_container slds-icon-utility-success slds-progress__marker slds-progress__marker_icon slds-progress__marker_icon-success" title="Complete">
Error in a Step#
When an error has occurred on a step, the <div>
with class .slds-progress__item
should also get the class .slds-has-error
.
- CompleteStep 1
- ErrorStep 2
- Step 3
- Step 4
- Step 5
<div class="slds-progress slds-progress_vertical">
<ol class="slds-progress__list">
<li class="slds-progress__item slds-is-completed">
<span class="slds-icon_container slds-icon-utility-success slds-progress__marker slds-progress__marker_icon" title="Complete">
Multiline Step Titles#
The vertical progress indicator also supports multiline step descriptions.
- CompleteStep 1
- ActiveStep 2
- Step 3: Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Praesent eget pellentesque lacus. Suspendisse euismod magna nec nulla ornare viverra. Sed pretium, eros ullamcorper scelerisque placerat, nunc velit volutpat libero, a semper lacus urna eget nibh. Maecenas eget tortor pulvinar, scelerisque nibh sed, fringilla erat. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Ut ultricies dui turpis, at posuere dolor convallis vitae.
- Step 4
- Step 5
<div class="slds-progress slds-progress_vertical">
<ol class="slds-progress__list">
<li class="slds-progress__item slds-is-completed">
<span class="slds-icon_container slds-icon-utility-success slds-progress__marker slds-progress__marker_icon" title="Complete">
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-progress |
---|---|
Summary | |
Support | dev-ready |
Restrict | div |
Variant | True |
Selector | .slds-progress_shade |
---|---|
Summary | When on a shaded background such as the modal footer |
Restrict | .slds-progress |
Modifier | True |
Selector | .slds-progress__list |
---|---|
Summary | An ordered list containing steps of a process |
Restrict | .slds-progress ol |
Selector | .slds-progress__list-bordered |
---|---|
Summary | Add borders between progress items |
Restrict | .slds-progress__list |
Selector | .slds-progress__item |
---|---|
Summary | A list item for each step of the process |
Restrict | .slds-progress ol li |
Selector | .slds-is-completed |
---|---|
Summary | Stateful class for a completed step, |
Restrict | .slds-progress__item |
Modifier | True |
Selector | .slds-is-active |
---|---|
Summary | Stateful class for the active step |
Restrict | .slds-progress__item |
Modifier | True |
Selector | .slds-has-error |
---|---|
Summary | Indicates error state for a step in the progress |
Restrict | .slds-progress__item |
Modifier | True |
Selector | .slds-progress__item_content |
---|---|
Summary | Support content in line with progress marker |
Restrict | .slds-progress__item div |
Selector | .slds-progress__marker |
---|---|
Summary | Dot indicator for each step |
Restrict | .slds-progress ol li button, .slds-progress ol li div, .slds-progress ol li span |
Selector | .slds-progress__marker_icon |
---|---|
Summary | Modifier that notifies the marker indicator that the step has been completed and its getting an icon |
Restrict | .slds-progress__marker |
Selector | .slds-progress__marker_icon-success |
---|---|
Summary | Turn completed stage checkmark green |
Restrict | .slds-progress__marker_icon |
Selector | .slds-progress_vertical |
---|---|
Summary | |
Support | dev-ready |
Restrict | .slds-progress |
Variant | True |
Selector | .slds-progress_success |
---|---|
Summary | Creates a green bar for the vertical variant |
Restrict | .slds-progress_vertical |
Progress Indicator Release Notes
2.16.0
Added
- Added
aria-label
attribute to the div with role ofprogressbar
to meet accessibility requirements.2.13.0
Fixed
- Addressed issue where button icons in progress items were misaligned for mobile/touch
2.11.7
Added
- Added documentation and examples for mobile/touch context
2.10.0
Changed
- Updated how the vertical variant handles the layout of its indicators so pixel nudging becomes deprecated (e.x.
margin-left: 1px
on.slds-progress__item.slds-is-completed .slds-progress__marker_icon
) - For touch devices:
- Increased tap target size of contained
.slds-button
to a height equal to$height-tappable
(2.75rem) using:before
pseudo element - Increased icon and marker size to
$square-tappable-xx-small
(1.25rem) - For vertical variant, increased font size to
$font-size-4
(0.875rem)
- Increased tap target size of contained
2.8.1
Fixed
- IE11: Layout issues when in a modal