MUI5 Stepper unexpected vertical line when calling from function

187 views Asked by At

Hi I am trying to develop MUI5 vertical stepper but got issue when rendering steps from function. So, there is one extra connector line on top of first step.

https://codesandbox.io/s/customizedsteppers-material-demo-forked-vpgt8i?file=/demo.tsx

enter image description here

1

There are 1 answers

2
Roman On

You need to call the component as a function.

const steps = ["Step1", "Step2", "Step3"];

const RenderTree = ({ label }) => (
  <Step>
    <StepLabel>{label}</StepLabel>
  </Step>
);

export default function CustomizedSteppers() {
  return (
    <Stepper orientation="vertical">
      {steps.map((label) => RenderTree({ label }))}
    </Stepper>
  );
}