[stepper] Proper support for vertical alternativeLabel#48485
Conversation
Deploy previewBundle size
Check out the code infra dashboard for more information about this PR. |
There was a problem hiding this comment.
Pull request overview
This PR extends Material UI Stepper styling so alternativeLabel works properly when the Stepper is in vertical orientation, primarily by mirroring/alignment adjustments across Step, StepLabel, StepConnector, and StepContent.
Changes:
- Add vertical +
alternativeLabelstyling variants to align the stepper/labels/connectors for the mirrored vertical layout. - Update
StepContentto consumealternativeLabelfromStepperContextand apply right-aligned spacing/border styles when enabled. - Refine
Stepvariants to differentiate horizontal vs verticalalternativeLabellayout behavior.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/mui-material/src/Stepper/Stepper.js | Adds a vertical+alternativeLabel variant to adjust cross-axis alignment. |
| packages/mui-material/src/StepLabel/StepLabel.js | Adds vertical+alternativeLabel variants to flip label layout and adjust spacing/alignment. |
| packages/mui-material/src/StepContent/StepContent.js | Adds alternativeLabel styling for mirrored vertical content and threads alternativeLabel into ownerState. |
| packages/mui-material/src/StepConnector/StepConnector.js | Splits alternativeLabel handling by orientation and adds vertical+alternativeLabel margins. |
| packages/mui-material/src/Step/Step.js | Adds new variants for horizontal (non-alt) and vertical (alt) layouts. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
siriwatknp
left a comment
There was a problem hiding this comment.
It should be either in the docs demo or regression to appear in Argos.
|
The |
50ecfb0 to
b9542d9
Compare
b9542d9 to
431dd68
Compare
| [`&.${stepLabelClasses.alternativeLabel}`]: { | ||
| flexDirection: 'row-reverse', | ||
| }, |
There was a problem hiding this comment.
this is strange. it's either variant or classname, not both.
{
props: { orientation: 'vertical', alternativeLabel: true },
style: { flexDirection: 'row-reverse' }
}
or
…base styles
[`&.${stepLabelClasses.alternativeLabel}`]: {
flexDirection: 'row-reverse',
}
ZeeshanTamboli
left a comment
There was a problem hiding this comment.
Perhaps not related to this PR, but it seems wrong that the Transition section is under the Vertical Stepper section in the docs.
6e0bf80 to
27ed6fd
Compare
27ed6fd to
b017616
Compare
Related to this, it's the text-align property. Not sure what to add instead, maybe leave it to the user? My main objective with this PR is to make the vertical+alernativeLabel example not look like we haven't even considered it. As mentioned above, the alternative would have been to thrown an error and not change anything. @siriwatknp |
Codex also flagged this:
Maybe we could set |
| props: { orientation: 'vertical' }, | ||
| style: { | ||
| flexDirection: 'column', | ||
| }, |
There was a problem hiding this comment.
Codex finding:
packages/mui-material/src/Stepper/Stepper.jsmakes vertical steppers a column, butpackages/mui-material/src/Step/Step.js#L68appliesflex: 1to everyalternativeLabelstep regardless of orientation. In a height-constrained vertical stepper – e.g. fixedheight,aflex/gridparent, a drawer/sidebar layout – this makes steps grow and distribute vertically, unlike regular vertical steppers. Scope that rule to{ orientation: 'horizontal', alternativeLabel: true }.





Properly support
verticalorientation withalternativeLabel.Move the steps and the content to the opposite side using variant overrides. Another option would have been to ignore the alternativeLabel prop when vertical orientation is used, and show a warning. But supporting it visually without showing a broken UI seems to be better.