Skip to content

CdsStages

Deprecated

A stage bar shows the course of a business process: which stages are behind, which one is running now and where the process stopped because of an error. The component only displays the status — the stages are not clickable, so the bar fits cards, headers and lists where the state of the process has to be read at a glance.

Storybook GitLab Figma
Test coverage: 100% — good coverage
API in specs
13 / 13 props, events, slots and exposed members with a test
Test cases
17 unit · 0 browser · 4 planned
Known bugs
1 pinned by an it.fails test
Code coverage
100% lines · 100% branches measured in v4.0.0-alpha.13
A11y (axe)
9 recommendations in 9 stories measured in v4.0.0-alpha.11

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 the interactive prop the steps are not clickable, and the header without items works as a status tracker (see the "Request status" scenario). Mind that the look differs: CdsStages is an arrow bar, CdsSteps is 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

NameTypeDefaultDescription
currentstring | number | null | undefinednullCurrent stage
finishedboolean | undefined—All stages are finished
itemChildrenSelectItemKey'children'Object field that holds the child items, or a function that returns them
itemPropsSelectItemKey'props'Object field that holds the props of the item, or a function that returns them
itemsany[] | undefined[]Array of items to display
itemTitleSelectItemKey'title'Object field used as the item title, or a function that returns it
itemTypeSelectItemKey'type'Object field that defines the item type (item, divider, subheader), or a function that returns it
itemValueSelectItemKey'value'Object field used as the item value, or a function that returns it
returnObjectboolean | undefined—Return an object in the model value instead of an array
themestring | undefined—Component theme
valueComparatorValueComparator | undefined—Function that compares item values to determine the selected state

Exposed

NameTypeDescription
isCurrent(idx: number) => booleanChecks whether the stage with the given index is the current one.
isFinishedbooleanWhether all the stages are passed.