question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How to change the numbers in steps of material ui stepper

See original GitHub issue

I asked the question: https://stackoverflow.com/q/51492162/5946125

Steps takes the numbers which are length of the steps state array ex:

   state = {
       steps: [0, 1, 2, 3]
    };

Later this state may change to :

    this.setState({
      steps: [1,2,3,4]
    });

Or

  this.setState({
     steps: [2,3,4,5]
   }); 

and so on… This is the code for stepper.

 <Stepper alternativeLabel nonLinear activeStep={activePage}>
        {steps.map((step, index) => {
          return (
            <Step key={index}>
               <StepLabel 
                  onClick={this.handleStep(step)}
                  disabled={dealsLoading}
               >
                {step}
              </StepLabel>
            </Step>
          );
        })}
      </Stepper>

But in all the cases my steps show only 1,2,3,4,. I need to change those numbers according to the steps’ state array.

stepper

If I change initial state of steps to [1,2,5,6] (some random) also, step buttons are still 1,2,3,4. Why don’t they change? Or how to change?

If I use StepLabel component it looks like and code for this:

steplable

 <Stepper alternativeLabel nonLinear activeStep={activePage}>
        {steps.map((step, index) => {
          return (
            <Step key={index}>
               <StepLabel 
                  onClick={this.handleStep(step)}
                  disabled={dealsLoading}
               >
                {step}
              </StepLabel>
            </Step>
          );
        })}
      </Stepper>

But I don’t want label. I want those labels should be on step buttons.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:9 (2 by maintainers)

github_iconTop GitHub Comments

8reactions
mbrookescommented, Jul 24, 2018

Use the icon attribute of StepLabel.

5reactions
mbrookescommented, Aug 6, 2019

@JustinStoddard

For example icon={3} or icon="A"

Line 63 in demo.tsx:

https://codesandbox.io/s/material-demo-6mdwm

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to change the numbers in steps of material-ui Stepper?
steps : [0 ; this.setState ; this.setState ; Stepper alternativeLabel nonLinear activeStep={activePage}> {steps.map ; Stepper alternativeLabel ...
Read more >
How to change the numbers in steps of material ui stepper
I need to change those numbers according to the steps' state array. ... If I change initial state of steps to [1,2,5,6] (some...
Read more >
React Stepper component - Material UI - MUI
Steppers convey progress through numbered steps. It provides a wizard-like workflow. Steppers display progress through a sequence of logical and numbered steps.
Read more >
How to change numbers in material ui stepper to alphabet like ...
[Solved]-How to change numbers in material ui stepper to alphabet like a,b,c ... from "@material-ui/core/Paper"; import Step from "@material-ui/core/Step"; ...
Read more >
How to use Stepper component in Material-UI React
Using activeStep, we can give one number value to Step, which will change the current active step. <Stepper activeStep={1}>.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found