A ProgressList displays the steps of a multi-step process and indicates which of the steps the user has completed.
- CompletedCart
- CompletedShipping
- CurrentPayment
- Not completedReview
ProgressList vs. Wizard
ProgressList to show the user's progress through steps. Use a Wizard if any of the steps need to be interactive.Content
ProgressList follows the Collection Components API, accepting both static and dynamic collections. This example shows a dynamic collection, passing a list of objects to the items prop, and a function to render the children.
- CompletedAccount
- CurrentProfile
- Not completedSettings
- Not completedConfirm
import {ProgressList, ProgressListItem} from './ProgressList';
let steps = [
{id: 'account', label: 'Account'},
{id: 'profile', label: 'Profile'},
{id: 'settings', label: 'Settings'},
{id: 'confirm', label: 'Confirm'}
];
<ProgressList
aria-label="Sign up"
items={steps}
selectedKey="profile">
{step => <ProgressListItem>{step.label}</ProgressListItem>}
</ProgressList>
Accessibility
aria-label or aria-labelledby that describes the process, such as "Checkout". Each step announces whether it is completed, current, or not completed, and the current step is marked with aria-current="step".Current step
Use the selectedKey prop to set the current step. The current step is marked with aria-current="step", and the steps before it are marked as completed. Use the data-current and data-completed attributes to style them.
- CompletedCart
- CurrentShipping
- Not completedPayment
- Not completedReview
import {ProgressList, ProgressListItem} from './ProgressList';
import {Button} from './Button';
import {useState} from 'react';
let steps = [
{id: 'cart', label: 'Cart'},
{id: 'shipping', label: 'Shipping'},
{id: 'payment', label: 'Payment'},
{id: 'review', label: 'Review'}
];
function Example() {
let [index, setIndex] = useState(1);
return (
<div style={{display: 'flex', flexDirection: 'column', alignItems: 'start', gap: 16, maxWidth: '100%'}}>
<ProgressList
aria-label="Checkout"
items={steps}
selectedKey={steps[index].id}>
{step => <ProgressListItem>{step.label}</ProgressListItem>}
</ProgressList>
<div style={{display: 'flex', gap: 8}}>
<Button onPress={() => setIndex(Math.max(0, index - 1))}>Back</Button>
<Button onPress={() => setIndex(Math.min(steps.length - 1, index + 1))}>Next</Button>
</div>
</div>
);
}
API
<ProgressList>
<ProgressListItem>
<ProgressListItemContent />
</ProgressListItem>
</ProgressList>
ProgressList
A ProgressList displays the steps of a multi-step process and indicates which of the steps the user has completed.
| Name | Type | |
|---|---|---|
children | ReactNode | | |
The contents of the collection. | ||
items | Iterable | |
Item objects in the collection. | ||
dependencies | ReadonlyArray | |
Values that should invalidate the item cache when using dynamic collections. | ||
selectedKey | Key | |
The | ||
style | CSSProperties | |
The inline style for the element. | ||
className | string | |
The CSS className for the element. | ||
aria-label | string | |
Defines a string value that labels the current element. | ||
aria-labelledby | string | |
Identifies the element (or elements) that labels the current element. | ||
aria-describedby | string | |
Identifies the element (or elements) that describes the object. | ||
aria-details | string | |
Identifies the element (or elements) that provide a detailed, extended description for the object. | ||
slot | string | null | |
A slot name for the component. Slots allow the component to receive props from a parent
component. An explicit | ||
render | DOMRenderFunction | |
Overrides the default DOM element with a custom render function. This allows rendering existing components with built-in styles and behaviors such as router links, animation libraries, and pre-styled components. Requirements:
| ||
Default className: react-aria-ProgressList
ProgressListItem
A ProgressListItem represents an individual step within a <ProgressList>.
| Name | Type | |
|---|---|---|
id | Key | |
A unique id for the step, which is compared against the | ||
children | ChildrenOrFunction | |
The children of the component. A function may be provided to alter the children based on component state. | ||
style | StyleOrFunction | |
The inline style for the element. A function may be provided to compute the style based on component state. | ||
className | ClassNameOrFunction | |
The CSS className for the element. A function may be provided to compute the class based on component state. | ||
aria-label | string | |
Defines a string value that labels the current element. | ||
aria-labelledby | string | |
Identifies the element (or elements) that labels the current element. | ||
aria-describedby | string | |
Identifies the element (or elements) that describes the object. | ||
aria-details | string | |
Identifies the element (or elements) that provide a detailed, extended description for the object. | ||
render | DOMRenderFunction | |
Overrides the default DOM element with a custom render function. This allows rendering existing components with built-in styles and behaviors such as router links, animation libraries, and pre-styled components. Requirements:
| ||
Default className: react-aria-ProgressListItem
| Render Prop | CSS Selector |
|---|---|
isCurrent | CSS Selector: [data-current]
|
| Whether the step is the currently selected step. | |
isCompleted | CSS Selector: [data-completed]
|
| Whether the step is rendered before the currently selected step. | |
stepNumber | CSS Selector: — |
The position of the step within the ProgressList, starting from 1. | |
ProgressListItemContent
A ProgressListItemContent renders the content of a <ProgressListItem>.
| Name | Type | |
|---|---|---|
children | ReactNode | |
The children of the component. | ||
style | CSSProperties | |
The inline style for the element. | ||
className | string | |
The CSS className for the element. | ||
id | string | |
The element's unique identifier. See MDN. | ||
aria-label | string | |
Defines a string value that labels the current element. | ||
aria-labelledby | string | |
Identifies the element (or elements) that labels the current element. | ||
aria-describedby | string | |
Identifies the element (or elements) that describes the object. | ||
aria-details | string | |
Identifies the element (or elements) that provide a detailed, extended description for the object. | ||
render | DOMRenderFunction | |
Overrides the default DOM element with a custom render function. This allows rendering existing components with built-in styles and behaviors such as router links, animation libraries, and pre-styled components. Requirements:
| ||