Another class is overriding the border of the text-box

  • I'm facing a challenge in customizing the material ui css.
  • Specifically, I want to set the border color of a textbox to red.
  • The issue arises when the bottom border gets overwritten.
  • Upon investigation, I discovered that the culprit is the class MuiInput-underline-904:before.
  • Can anyone guide me on how to resolve this?
  • Here is my code snippet and sandbox link for reference.

https://codesandbox.io/s/nk2ym81qwl

  textField: {
    flexBasis: 200,
    border: "1px solid red"
  }

<TextField
          select
          label="With Select"
          className={classNames(classes.margin, classes.textField)}
          value={this.state.weightRange}
          onChange={this.handleChange("weightRange")}
          InputProps={{
            startAdornment: <InputAdornment position="start">Kg</InputAdornment>
          }}
        >
          {ranges.map(option => (
            <MenuItem key={option.value} value={option.value}>
              {option.label}
            </MenuItem>
          ))}
        </TextField>

The problem can be attributed to the following code:

.MuiInput-underline-904:before {
    left: 0;
    right: 0;
    bottom: 0;
    content: "\00a0";
    position: absolute;
    transition: border-bottom-color 200ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;
    border-bottom: 1px solid rgba(0, 0, 0, 0.42);
    pointer-events: none;
}


<div class="MuiInputBase-root-913 MuiInput-root-900 MuiInput-underline-904 MuiInputBase-formControl-914 MuiInput-formControl-901 MuiInputBase-adornedStart-917">

Answer №1

inputField {
  flexBasis: 200,
  border: 1px solid blue !important;
}

Implement !important for a stronger style declaration.

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

Show/Hide a row in a table with a text input based on the selected dropdown choice using Javascript

Can someone please assist me with this issue? When I choose Business/Corporate from the dropdown menu, the table row becomes visible as expected. However, when I switch back to Residential/Consumer, the row does not hide. My goal is to only display the row ...

Changing the background color of a selected table row in React using Material-UI

Utilizing React and Material-UI, I am facing an issue where the selected table row background inherits the muiTheme borderColor by default. However, changing the borderColor affects other elements as well. How can I adjust only the table row background f ...

Sending data to a child component through an onClick event handler

Can someone help me figure out how to make the Overlay inside the InviteButton visible when clicking on it? I want to use the prop show={true}, but I'm struggling with this implementation. Any assistance or guidance would be greatly appreciated. ----f ...

React, ShoppingCart, and browser storage

I am experiencing two issues with my shopping cart. The first problem is that when I increase or decrease the quantity of an item in the cart, it moves to the bottom of the item list. Additionally, I have been attempting to save the items, quantities, and ...

Attempting to toggle the menu with jQuery does not yield any results

I am fairly new to the world of javascript and jQuery and I'm encountering some issues that are proving difficult to troubleshoot. I am experimenting with the .toggle function on a menu list, but when I click the temporary button I've set up for ...

Unable to connect to React Node Socket.IO application from any source other than localhost using IPv4 and NGROK

I recently followed a tutorial on creating a simple React app/Node with Socket.IO. The tutorial worked perfectly, so I decided to test it with two other devices: One PC on the same wifi network (via IPv4 - 192.168.1.8:3000) A mobile device using Ngrok tun ...

Resizing rectangular images with CSS/Bootstrap into perfect squares

Imagine there is a rectangular image with dimensions of 1400px (height) x 700px (width). I am looking to turn it into a square while maintaining its original proportions and having white sides added. I specifically do not want to crop the image - I want it ...

Angular JS does not acknowledge null values

Within my controller, the variable $scope.test is assigned a value from the server. When this value is null, line 1 of the code below prints 'null', however it still enters the else condition. I have attempted to use $scope.test != null and $scop ...

Retrieve webpage content using an ajax request in JavaScript

I'm working on an HTML page with an Ajax call to load table content. <html> .... <script sec:haspermission="VIEW_NOTE" th:inline='javascript'> require(['app/agent/viewGlobalAgent'], function (){ ...

What is the technique for rearranging columns to be at the top in Foundation for mobile devices?

On my desktop, I have a layout like this: [Column1 large-8] [Column2 large-4] For mobile view, I'd like it to be like this: [Column2 large-4] [Column1 large-8] Below is the code snippet I am working with: <div id="search-content" class="row ma ...

"Using Node.js Express 4.4 to efficiently upload files and store them in a dynamically

Looking for recommendations on the most efficient method to upload a file in node.js using express 4.4.1 and save it to a dynamically created directory? For example, like this: /uploads/john/image.png, uploads/mike/2.png ...

Need to modify the appearance of the calendar icon in the TextField date-picker? This guide will show you how to change its color specifically in

Is there a way to customize the color of the date-picker icon? IMG I've tried various options, but haven't been successful in changing the icon's color. I managed to change the color of the TextFiled select using '.MuiSelect-icon'. ...

Having trouble with Vuejs Ternary Operator or Conditional in v-bind-style?

Having some unexpected issues while trying to implement a style conditional for items in Vuejs. I have come across Stack Overflow posts on how to use a ternary, either through an interpolated string or a computed style object. I've attempted both met ...

Customize your error messages in AJAX requests

The form on my index.php page submits to process.php, triggering the execution of the code below: $(document).ready(function() { $('#login_button').click(function() { event.preventDefault(); var formData = { 'email' ...

I successfully installed the Firebase tools using npm, but encountered an error during the process

Alert: Please choose at least one feature. Press SPACEBAR to select features, or mention a feature by executing firebase init [feature_name] ...

Neglecting to include an HTTP header

I am attempting to create an HTTP request with an Authorization header: $.ajax({ type: 'GET', url: "https://subdomain.domain.com/login", beforeSend: function (xhr) { xhr.setRequestHeader ("Auth ...

Connecting Vue component data to external state sources

I am facing a challenge with integrating a Vue component into a large legacy system that is not based on Vue. This component retrieves data through AJAX requests and displays information based on an array of database record IDs, typically passed at page lo ...

I've encountered some issues with importing pagination from modules after installing SwiperJs

Having some issues with importing pagination from modules in SwiperJs for my nextjs project. The error message "Module not found: Package path ./modules is not exported from package" keeps popping up. I have tried updating the module to the latest version ...

Rotate the front view image to the left view with a three-dimensional twist

I've been attempting to rotate the image using the code below, but I can only manage to go from a front view to a bottom view. My goal is to rotate the image from the front view to the left view. Is there a way for me to achieve this? body { heig ...

A guide on utilizing Python with Selenium to navigate to a specific field within a frame

I am seeking assistance in using Selenium with Python to target a specific element that seems to be located inside a frame. Specifically, I am attempting to select the element with 'id' = 'kiadvany_cim' within what appears to be a windo ...