The component is deprecated: do not write new code with it. It keeps working across the whole 4.x line and prints a
[CDS UPGRADE]warning in the dev console; it will be removed in 5.0. To show the course of a process without step navigation use CdsSteps — without theinteractiveprop the steps are not clickable, and the header withoutitemsworks as a status tracker (see the "Request status" scenario). Mind that the look differs:CdsStagesis an arrow bar,CdsStepsis a row of indicators with a progress line. To switch between equally weighted sections — CdsTabs.
Anatomy
The bar is a row of stages: each one has a title, and the arrow separators between neighboring stages set the direction of the process. The color of a stage encodes its state: neutral — the stage is ahead, accented — it is the current one, green — passed, red — an error.
Variations
Stages
Pass an array of objects into items: the title and the value of a stage are read by the item-title and item-value keys (title and value by default). As long as current is not set, all the stages stay neutral — the process has not started yet.
The current stage
current takes the value of the active stage: it is highlighted with the accent color, and the stages to the left of it are marked as passed.
An error
An error is set in the data of a stage — props: { error: true } on an items element. The stage turns red once the process has reached it: when it is the current one or is already passed.
Finishing the process
The finished prop marks all the stages as passed at once — the value of current does not matter then.
Guidelines
Scenarios
Order progress
The value of current comes from the data and changes as the order is processed. Once the last stage is passed, turn finished on — the whole bar becomes green.
Rejected during review
The status of the listing is stored as a single string, and items, current and finished are computed from it. On rejection the "Проверка" stage gets props.error and turns red — the user immediately sees where the process stopped.
Statuses in a list
The bar is compact and does not intercept clicks, so it is easy to repeat in every row of a list or a table: the width comes from a utility class, and the state of the row from its own current, finished and error.
API
Props
| Name | Type | Default | Description |
|---|---|---|---|
current | string | number | null | undefined | null | Current stage |
finished | boolean | undefined | — | All stages are finished |
itemChildren | SelectItemKey | 'children' | Object field that holds the child items, or a function that returns them |
itemProps | SelectItemKey | 'props' | Object field that holds the props of the item, or a function that returns them |
items | any[] | undefined | [] | Array of items to display |
itemTitle | SelectItemKey | 'title' | Object field used as the item title, or a function that returns it |
itemType | SelectItemKey | 'type' | Object field that defines the item type (item, divider, subheader), or a function that returns it |
itemValue | SelectItemKey | 'value' | Object field used as the item value, or a function that returns it |
returnObject | boolean | undefined | — | Return an object in the model value instead of an array |
theme | string | undefined | — | Component theme |
valueComparator | ValueComparator | undefined | — | Function that compares item values to determine the selected state |
Exposed
| Name | Type | Description |
|---|---|---|
isCurrent | (idx: number) => boolean | Checks whether the stage with the given index is the current one. |
isFinished | boolean | Whether all the stages are passed. |