Error icon appearing on Material UI's Stepper Component when not needed

I am currently using the Stepper component from Material UI and attempting to make the fill of a stepper that is in its error state appear red.

If you need to see the Stepper component from Material UI's documentation, you can access it https://i.sstatic.net/kKmvH.png.

My goal is to display an error state without showing the provided icon that comes with the error prop in Material UI.

You can check out the image for reference here: https://i.sstatic.net/MuACo.png.

All I want is for it to resemble any other stepper, but with a red background.

Is there a way to remove the icon and just display a solid red fill?

I've looked everywhere, but it seems like nobody has really asked about this before.

Here is the code snippet:

<Stepper alternativeLabel activeStep={this.determineFormStep()} connector={<StepConnector />} className={classes.stepper}>
          {formLabels.map((label) => {
            return (
              <Step key={label}>
                <StepLabel
                  error
                  StepIconProps={{
                    classes: {
                      root: classes.step,
                      completed: classes.completed,
                      active: classes.active,
                      error: classes.error,
                      disabled: classes.disabled
                    }
                  }}>
                  <div className={classes.stepLabelRoot}>
                    <Typography className={classes.label}>
                      {label.label}
                    </Typography>
                    <span className={classes.sublabel}>
                      {label.sublabel1}
                    </span>
                    <span className={classes.sublabel}>
                      {label.sublabel2}
                    </span>
                    <span className={classes.sublabel}>
                      {label.sublabel3}
                    </span>
                  </div>
                </StepLabel>
              </Step>);
          })}
        </Stepper>

Answer №1

StepLabel documentation explains how it's possible to use an optional icon prop to customize the step icon.

For instance, if you wish to hide the icon completely, you can simply pass a Fragment element as the icon:

<StepLabel
    error
    icon={<></>}
>
    ...
</StepLabel>

Alternatively, you have the option to modify the StepIconComponent or StepIconProps.

Below is an example showcasing how to disable the error state only for the icon:

<StepLabel
    error
    StepIconProps={ {error: false} }
>
    ...
</StepLabel>

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

changing a string into an array in react native

Extracted from an API, I am given the following string: [10, 20, 22, 26]. These values are mapped to [A, B, C, D], and I have a slider with values [1, 2, 3, 4]. What I am trying to achieve is that when you select 1 on the slider, it displays the value of A ...

Alert: Font preload was not utilized within a short timeframe after the window's load event

I've been working on optimizing the loading speed of fonts on my website, so I added the following: <link rel="preload" href="{{ '/css/fonts/bebasneue-webfont.woff' | prepend: site.baseurl | prepend: site.url }}" as="font" type="fo ...

Leveraging the outcome of an API request with Protractor

I have developed a small API that generates test data instantly. Each request creates a new user and provides the relevant data. For fetching the data, I utilize the 'request' package: var flow = protractor.promise.controlFlow(); var result = f ...

Tips for including items in a list nested within a dictionary using JavaScript

I'm currently working with a JavaScript dictionary and I need to insert an element into a list that belongs to a specific key within the dictionary. Check out the code snippet below: lines = [ [1,2], [2,4], [2,3], [3,5] ]; nodes = [ ...

What is the best way to retrieve all keys from an array or object within the selection in cxjs?

I have a List with Objects and I want the selection to carry the complete Objects. The current property selection method is not working for me. Is there a way to achieve this? ... records:bind="$myWindow.ObjectList" selection={{ ...

tips for sending URL parameters to the server using AJAX

It may seem like a simple task, but I've struggled to find a practical solution. Let's consider an URL with a GET value of: /?userid=1 How can I pass the dynamic value of 1 using AJAX? The userid varies based on the link that is clicked, so i ...

My tests are not passing because I included a compare method in the Array prototype. What steps can I take to fix this issue in either the

Embarking on the challenging Mars Rover Kata has presented a unique problem for me. My jasmine tests are failing because of my array compare method within the prototype. This method is crucial for detecting obstacles at specific grid points. For instance, ...

Is it time to ditch Internet Explorer for EDGE?

Have you ever noticed that when attempting to access the stackoverflow website on Internet Explorer, the tab mysteriously closes and Microsoft Edge opens with stackoverflow loaded? What is the secret behind this strange phenomenon on stackoverflow's ...

What is the limit on the amount of input data (in CSV or JSON format) that can be used to create a

Attempting to visualize a large dataset using D3.js has posed a challenge for me. The data size is 261 MB with approximately 400,000 rows in CSV format. Even when I attempt to run it with just 100,000 rows, the visualization does not appear on the browser. ...

The canvas game's animation can only be activated one time

I am currently working on designing a straightforward canvas game: Here is the code snippet located on CodePen var canvas; var ctx; var x = 300; var y = 400; var r = 0; var mx = 0; var my = 0; var WIDTH = 600; var HEIGHT = 400; function circle(x,y,r) ...

selector must begin with attribute in order to only target the first input field and not any others

Having trouble with the attribute starts with selector for validation of fields with dynamic IDs. Tried multiple approaches but haven't been successful. Here's what I've attempted so far: I have looked at other suggestions on Stack Overflo ...

The challenge of Webpack errors arising from sharing a project between two different machines

My project is saved in a Google Drive folder and runs smoothly on one of my machines. However, when I try to compile the code on another machine, I encounter multiple errors all related to loading images. The error message below is just one example (others ...

Get the Google Sheets file and extract information by utilizing SheetJS in NodeJS

I have a spreadsheet on Google Sheets that contains important data which I've made publicly accessible. This allows me to download the data as an .xlsx file using a specific URL. In my Node.js project, I am looking to achieve the following tasks: Do ...

What issues arise when using the `--fix` flag to automate ESLint?

Is it beneficial to automate ESLint with the --fix flag, or could there be potential drawbacks in the future? One scenario is utilizing npm and including the "prestart" script. This setup triggers ESLint every time npm start is invoked and automatically c ...

What is the best way to show the probability of users' bets in percentage form based on their wagered amounts?

I am currently working on creating a Jackpot Roulette game that features a main pot. Each round sees users joining and placing bets that contribute to the main pot, with the winner taking home the entire amount. My goal is to provide each user with real-t ...

What exactly does the term "entry point" refer to within the context of npm init?

Starting a new project can be overwhelming, especially when faced with a list of questions during the npm init process. One question that often stumps developers is "entry point." The options provided, like name, version, and description, may seem straig ...

How can I utilize the pick parameter in nuxtjs3 useFetch for selecting arrays or performing a deep pick?

Currently working on my nuxtjs3 project, where I am extracting data from an API. Specifically using jsonPlaceholder for this task. Extracting data from a single object is not a problem: const { data: useFetchOnly } = await useFetch('https://jsonplace ...

The Jade template engine encountered a problem when attempting to include the <p> tag within a div element

Encountered an issue when trying to add a "p" tag inside the div. Here is my code: !!! html head title= title link(rel='stylesheet', href='/stylesheets/#{stylesheet}.css') link(rel='stylesheet', href='/styles ...

Use JSON data to populate a dynamic bar chart in Highcharts

As a beginner in parsing JSON objects to highcharts, I am trying to create a basic bar graph. I have managed to set up the title of the graph, but I am having trouble displaying the series that I want to show (count as series and qpAnswer as xAxis). Below ...

FirebaseError: The type 'Hc' was expected, but instead, a custom Yc object was provided

I've encountered an issue while attempting to perform a batch entry. The error I'm facing involves passing an array in a .doc file. Interestingly, this approach seems to work perfectly fine on another function where I pass an array into a .doc us ...