Stepper
Steppers display progress through a sequence of separate steps towards a particular goal for more complex tasks. This provides a more manageable experience by allowing the user to focus on smaller pieces of the task at hand.
This stepper can be used not only for initial setup, but also for future configuration changes over time by linking to the relevant step.
Steps
On page load, all steps will display a number and short label to help the user understand the sequence of actions towards setup or creation. Steppers should follow a linear progression, requiring the user to navigate between all steps in chronological order for initial setup Incomplete and active steps will always display a number. Completed steps will display a checkmark icon. Steps missing required input from the user will display the step error state.
Navigation
The "Next" button, positioned on the right side of the footer, is used to progress to the next step in the process. This button should be active and available at all times. On the final workflow step, this button can display a contextual label related to the action (ex: 'FINISH', or 'APPLY'). When the user has moved past the first step, display a Secondary outline button with a 'Back' label all the way to the left in the footer to allow them to move backwards in a linear progression. The user can navigate back a single step, or multiple, but can only move forward with the 'Next' button in the footer. (The numbered steps and check marks are not interactive) The user may move back a step if they have not completed the active step without validation being required for the current step. Any actions that have been taken on the current step should be retained (data should not be cleared unless the user is warned. Note: Future use cases may require a third action button, positioned directly before the “Next” button, on the right. Examples include saving a draft or launching a preview within the flow.
Errors and warnings
Display the step error state and do not allow the user to move ahead on any step missing required input from the user. The error state should display a contextual label related to the active step. Request confirmation from users who choose to exit and discontinue before completing all steps in the workflow. The user should understand that all edits and changes will be lost if they do so. Display a browser confirmation dialog when closing the tab or navigating with the browser back button before completing all steps in the workflow. The user should understand that all edits and changes will be lost if they proceed.
Basic Usage
A Stepper
must wrap a set of composed subcomponents:
Stepper.Header
Stepper.Step
Stepper.ActionRow
The order of steps is dictated by the order of Stepper.Step
components in the code.
Stepper.Step
and Stepper.ActionRow
are hidden until their eventKey
props match the activeKey
on Stepper
.
Any Paragon component or export may be added to the code example.
Clickable Header
Use Stepper.Step
's onClick
prop to enable clickable behaviour for step's header. This should primarily be used to
implement navigation between steps by clicking on their headers.
Note: this prop takes effect (i.e., header becomes clickable) only after the step has been visited.
Basic usage
Any Paragon component or export may be added to the code example.
With Error State
Any Paragon component or export may be added to the code example.
In a modal
A composition of a stepper with a FullscreenModal
.
Any Paragon component or export may be added to the code example.
Error State
A composition of a stepper with the hasError
prop. Note that the index
prop is
also required for steps to rerender correctly here.
Any Paragon component or export may be added to the code example.
Theme Variables (SCSS)#
$stepper-header-bg: transparent !default;$stepper-header-min-height: 5.13rem !default;$stepper-header-padding-y: .75rem !default;$stepper-header-padding-x: $spacer !default;$stepper-header-line-bg: $light !default;$stepper-header-line-height: 1px !default;$stepper-header-step-color: $primary !default;$stepper-header-step-bg: $stepper-header-bg !default;$stepper-header-step-border: none !default;$stepper-header-step-min-width: 0 !default;$stepper-header-step-padding: .25rem !default;$stepper-header-step-list-padding-y: .25rem !default;$stepper-header-step-list-padding-x: 0 !default;$stepper-header-step-list-margin: 0 !default;$stepper-header-active-step-bg: $gray-500 !default;$stepper-header-step-error-bubble-color: $danger !default;$stepper-header-step-error-bubble-shadow-width: 3px !default;$stepper-header-step-error-description-color: $stepper-header-step-error-bubble-color !default;
Props API#
- children
node
RequiredSpecifies the content of the
Stepper
. - activeKey
string
RequiredThe eventKey of the step to display.
- children
node
RequiredSpecifies the content of the
Step
. - className
string
Specifies class name to append to the base element
- eventKey
string
RequiredAn identifier of the
Step
. WhenactiveKey
on theStepper
equals to theeventKey
, theStep
will be displayed. - title
string
RequiredA text of the
Step
. - description
string
A text under the
title
. - hasError
bool
DefaultfalseInforms user if this
Step
has errors. - index
number
Position of the
Step
, only required if adding error state or conditionally rendering steps. - onClick
func
Click handler for the
Step
. Takes effect only after theStep
has been visited, making it clickable and invoking this function on click. Should be used to provide navigation between steps.
- children
node
RequiredSpecifies the content of the
ActionRow
. - eventKey
string
RequiredAn identifier of the
ActionRow
. WhenactiveKey
on theStepper
equals to theeventKey
, theActionRow
will be displayed. - as
elementType
DefaultActionRowSpecifies the base element
- className
string
DefaultnullSpecifies class name to append to the base element.
- PageCountComponent
elementType
Default({ activeStepIndex, totalSteps }) => `Step ${activeStepIndex + 1} of ${totalSteps}`A component that receives
activeStepIndex
andtotalSteps
props to display them. - compactWidth
enum
'xs' | 'sm' | 'md' | 'lg' | 'xl' | 'xxl'Default'sm'The max width in which the compact view of the header will switch to display the step number that is currently in progress. Options include 'xs', 'sm', 'md', 'lg', 'xl', and 'xxl'.
- index
number
RequiredA number that will be display in the icon of the
HeaderStep
. - title
string
RequiredA text of the
HeaderStep
. - isActive
bool
DefaultfalseSpecifies that this
HeaderStep
is active. - hasError
bool
DefaultfalseInforms user if this
Step
has errors. - description
string
A text under the
title
. - onClick
func
Callback fired when element gets clicked.
Usage Insights#
Stepper
Project Name | Paragon Version | Instance Count | |
---|---|---|---|
frontend-app-admin-portal | 20.46.3 | 3 | |
frontend-app-course-authoring | 20.46.2 | 1 | |
frontend-app-learner-portal-enterprise | 20.45.4 | 1 |
StepperActionRow
Project Name | Paragon Version | Instance Count | |
---|---|---|---|
frontend-app-admin-portal | 20.46.3 | 9 | |
frontend-app-course-authoring | 20.46.2 | 2 | |
frontend-app-learner-portal-enterprise | 20.45.4 | 3 |
StepperHeader
Project Name | Paragon Version | Instance Count | |
---|---|---|---|
frontend-app-admin-portal | 20.46.3 | 2 | |
frontend-app-course-authoring | 20.46.2 | 1 |
StepperStep
Project Name | Paragon Version | Instance Count | |
---|---|---|---|
frontend-app-admin-portal | 20.46.3 | 9 | |
frontend-app-course-authoring | 20.46.2 | 2 | |
frontend-app-learner-portal-enterprise | 20.45.4 | 3 |