[ Feedback ]
StepPill
A step of a multi-step process as a pill: a numbered disc with a progress ring, the step title, and optionally a value, a status tag (Failed with retry, Completed) and an action. Built for transactions, deploys and imports.
Import#
import { StepPill } from 'reusify-ui';When to use#
- Showing each step of a transaction or job as it runs, fails and completes.
- Compact status rows in a toast, a sidebar or a modal.
- For a whole list of steps in one card, StepList is lighter.
Examples#
Statuses#
active shows an orange progress arc (it spins when progress is not set), error a dashed ring and a Failed tag, complete a check and a Completed tag.
<StepPill step={2} title="Deposit USDC as Collateral" status="active" progress={30} action={expandButton} />
<StepPill step={3} title="Mint Project Token" status="error" value="$29,3K" onRetry={retry} action={expandButton} />
<StepPill step={4} title="Trade Successful" status="complete" value="$29,3K" action={expandButton} />
<StepPill step={5} title="Claim rewards" status="pending" />Retry#
onRetry adds a retry button to the Failed tag. This one switches to active, then completes.
const [status, setStatus] = useState('error');
<StepPill
step={3}
title="Mint project token"
value="$29,3K"
status={status}
onRetry={() => {
setStatus('active');
runMint().then(() => setStatus('complete'));
}}
/>Custom status tag#
statusLabel renames the tag, and showStatus shows it for active and pending steps too.
<StepPill step={1} title="Uploading files" status="active" progress={72} showStatus statusLabel="72%" />
<StepPill step={2} title="Waiting for approval" status="pending" showStatus statusLabel="Queued" />Used in designs#
StepPill in real layouts: this design uses it. Open one to try it and copy the code.
API reference#
<StepPill />
Renders a role="group" <div>; other props go on it.
| Prop | Type | Default | Description |
|---|---|---|---|
step | ReactNode | - | Number shown in the disc (a check once complete). |
title | ReactNode | - | Step name. |
status | 'pending' | 'active' | 'error' | 'complete' | 'pending' | Disc style and status tag. |
progress | number (0-100) | - | Arc length while active; omit for a spinning arc. |
value | ReactNode | - | Amount or detail after a divider. |
showStatus | boolean | status is 'error' or 'complete' | Show the status tag. |
statusLabel | ReactNode | - | Text of the status tag (Failed, Completed… by default). |
onRetry | () => void | - | Adds a retry button to the Failed tag. |
retryLabel | string | 'Retry' | Accessible name of the retry button. |
action | ReactNode | - | Trailing slot, e.g. an expand icon button. |
step-ReactNodeNumber shown in the disc (a check once complete).
title-ReactNodeStep name.
status'pending''pending' | 'active' | 'error' | 'complete'Disc style and status tag.
progress-number (0-100)Arc length while active; omit for a spinning arc.
value-ReactNodeAmount or detail after a divider.
showStatusstatus is 'error' or 'complete'booleanShow the status tag.
statusLabel-ReactNodeText of the status tag (Failed, Completed… by default).
onRetry-() => voidAdds a retry button to the Failed tag.
retryLabel'Retry'stringAccessible name of the retry button.
action-ReactNodeTrailing slot, e.g. an expand icon button.
Accessibility#
- The pill is a group named "<title>: <status>", so the status is announced even though the disc is decorative.
- The retry button has an accessible name (retryLabel) and a focus ring.
- The spinning arc slows down when the user prefers reduced motion.