Changing the color of a pseudo element in Material-UI

I'm having trouble changing the border color of the ::after pseudo element on a standard text field from MUI. I've been unable to figure it out.

<TextField id="standard-basic" label="Email" variant="standard"/>

This is the text field whose border color I want to change. The default color is blue. I have attempted the following:

    const inputProps = {
        style: {
          '&.MuiInput-input::after': {
            borderBottom:"2px solid red"
          },
        },
      };

<TextField id="standard-basic" label="Email" variant="standard" InputProps={inputProps} />

Unfortunately, it did not work!

Answer №1

Consider defining the variable and specifying the color type within the CSS script. This approach may result in a unique outcome. Pay close attention to the placement of semicolons and commas as well. I trust that these suggestions will be beneficial.

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

Transforming a dynamic HTML layout into a non-responsive one: "RESPONSIVE NO MORE"

I'm currently working with an HTML document that has a responsive design. However, I now need to make it non-responsive. Can someone advise me on the most efficient and fastest way to do this? I attempted using min-width for both html and body, but ...

Struggling to make a basic JavaScript prompt function as expected

<html> <title>UniqueTitle</title> <head> <link rel="stylesheet" type="text/css" href="style.css" > <script type="text/javascript"> function modifyDates() { var dates = pr ...

The hook from Supabase is facing issues with proper importing

This project is a Spotify clone. The issue I'm facing is related to importing the hook. The error message reads: React Hook "useSupabaseClient" is called in function "useloadArtistImage" that is neither a React function component nor a custom React H ...

Instructions for implementing personalized horizontal and vertical scrolling within Angular 9

I am currently working on an angular application where users can upload files, and I display the contents of the file on the user interface. These files may be quite long, so I would need vertical scrolling to navigate through them easily. Additionally, fo ...

Setting a default value in a multi-select dropdown using react-select

I have taken over management of my first React app, and I am facing a seemingly simple change that needs to be made. The modification involves an email signup page where users can select their interests from a multi-select dropdown menu. My task is to mak ...

Guide to Setting Up Infinite Scroll with Next JS SSG

I recently built a markdown blog using the Next Js documentation and incorporated Typescript. When trying to retrieve a list of blog posts, I utilized getStaticProps as recommended in the documentation. However, my attempts with certain npm packages were u ...

Establishing formik's initial value

I am currently using Formik to create a form. However, I am encountering an issue when trying to access a nested object inside initialValues. Here is an example of how I am setting it up: address:{title:"this is a title", value:{principalAddress:"test", se ...

Issues with CSS rendering have been encountered on the Facebook page

I'm experiencing an issue with the rollover CSS on Facebook's rendering engine. I'm not sure if I made a mistake in my code or if there are limitations with certain CSS properties on custom Facebook pages. Here is the code I am using: <l ...

In Form view in Odoo, the field value appears on the following line when editing

When attempting to edit a value in the form view, I am experiencing an issue where the field's value is being pushed onto the next line. <div class="row"> <label string="Website" for="field_id" class="col- ...

How can I showcase the data obtained from an API call in React?

Having successfully created API's for a standard transaction application (using mongoDB for DB), I have API's set up for users, products, and orders. While I've been able to effectively use and display the information stored about users and ...

Ways to trigger the FETCH API every time my Server-Side Component is loaded

I am looking for a way to re-fetch the data in my server-side component in Next.js every time the component is loaded (similar to how we make API calls using useEffect in client-side components). Currently, the API is only called again when I manually ref ...

The design of the website is all over the place

I am encountering challenges in creating distinct containers for the header, body, and other sections of my website. The layout is not turning out as planned, and I can't pinpoint where my code is going wrong. Any advice or suggestions on how to resol ...

Nested Loop in React JS with Arrays

Hey there, I could really use some help with looping through a JSON array. It's similar to the layout of an Instagram or Facebook post. I have a nested JSON array and the code I tried isn't working as expected. I'm aiming for a view that res ...

Encountering a "Module not found" error while attempting to access user session in getServerSideProps. The specific error is: "Error: Can't resolve 'dns'"

Currently, I am utilizing the next-auth module in my project. By integrating the mongodb adapter, users are automatically created in the database with basic information such as name, email, and avatar. However, I require additional data to be added on top ...

What is the best way to implement alphabetical pagination using Material UI Pagination?

I am attempting to display a list of words using MUI pagination, arranged in alphabetical order. Previous format 1,2,3,...,26 Desired format A,B,C,...,Z wordsList: { A: [], B: [], ..., Z: [] } ...

What is the best way to close an ajax page within the main page using a button?

I am dealing with a situation where I have 2 pages. The first page contains a div called 'ajaxicall', which loads another page inside it. The challenge I am facing is figuring out how to close the second page when I click on the "close" button w ...

What is the most reliable method for displaying an SVG shape in any color across various web browsers?

Is there a way to render a 2D SVG shape, which is flat and 100% black, in any color across various browsers? ...

jQuery - How come my string values are getting cut off?

It's been a while since I last worked with jQuery, and I seem to be missing something obvious that's affecting my calculations. I have various text boxes for Weight, Moisture %, and Number of Filled Squares, as well as a multi-select option for ...

Accordion's second child element experiencing issues with grid properties

I have set the parent element display:"Grid" and specified the gridColumnStart for my child elements as shown below. It seems to be working correctly for the first child element, but not for the second one. Please find my code attached: return ( ...

Ways to enhance the appearance of the parent element when the radio button is clicked

Hey there! So, I have a situation where I'm working with two radio buttons and I want to apply certain CSS styles to the parent box (<div>) when a radio button is selected (checked). Here's how I want it to look: box-shadow: 0 0 5px #5cd05 ...