Update the color of the angular material input text box to stand out

Hey there, I'm currently using Angular Material and I want to change the color of the input focus when clicked.

At the moment, it's displaying in purple by default, but I'd like it to be white instead.

https://i.stack.imgur.com/vXTEv.png

I've tried a lot of CSS options, but nothing seems to be working for me.

Here's an example link to a StackBlitz URL:

https://stackblitz.com/edit/material-input-sample?file=src/app/app.component.ts

Answer №1

One way to customize the appearance of mat-input elements is by leveraging the power of ::ng-deep.

::ng-deep {
  .mat-form-field-label {
    color: white !important;
  }

  .mat-form-field.mat-focused .mat-form-field-ripple {
    background-color: white !important;
  }
}

Check out this example on StackBlitz

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

Why isn't the CSS outline property functioning properly within the handlebars?

I am working on a login form within a Handlebars page and I am trying to figure out how to set the default outline property to none for that particular element. Does anyone know how to do this? Snippet of code from the Handlebars file <input type=" ...

When you hover over HTML tables, they dynamically rearrange or shift positions

Issue: I am encountering a problem with multiple tables where, upon hovering over a row, the tables are floating rather than remaining fixed in place. Additionally, when hovering over rows in the first or second table, the other tables start rendering unex ...

How to Utilize Nested CSS Selectors in Material-UI?

I'm struggling to implement a basic CSS task using makeStyles from Material-UI. Consider this straightforward example: <div classNames={clsx(wrapper, post.new && classes.new)}> <p classNames={text}>Post</p> <p> Som ...

Changing the State of a CheckBox with ReactJS and Material UI

Utilizing Material UI's Checkbox, I am creating a form to input data and update or add values into a state object. This form serves the purpose of both editing an existing holiday or adding a new one. I'm currently facing an issue where the stat ...

Ensuring compatibility with Internet Explorer 11 through Material-UI and React

I recently set out to incorporate material-ui into my React project. However, we are still required to support IE which has presented some challenges. Whenever I try to add any material-ui component, the app fails to display and countless undefined errors ...

Using Slick.JS to Sync Navigation with Main Slider, Automatically Resetting to First Slide

I have a question about the functionality of the Slick.JS plugin that I'm using. In my project, I have two carousels with five slides each. The top carousel displays one slide at a time, while the bottom carousel shows all five slides concurrently. My ...

Creating Angular models for complex nested JSON structures

I'm a beginner with Angular and I'm dealing with nested API responses from a Strapi application. I've set up a model using interfaces, but I'm having trouble accessing attributes from the product model when trying to access product data ...

What is the best way to connect or link to a HTML table row <tr>

Is there a way to trigger an alert when the user double clicks on the whole row? ...

Return a 404 status code in Angular 5

I'm facing a frustrating issue that is causing me trouble. For some reason, I can't get the 404 status to work with Angular 5. Here are the steps I've taken: In my server.ts file, I included const { AppServerModuleNgFactory, LAZY_MODUL ...

Different ways to update the AutoComplete Style attribute

MuiInput-formControl { margin-top: 16px; Is there a way to reset the marginTop property to zero? I attempted the following method, but it was not successful. MuiFormControlLabel: { marginTop: 0, }, <Autocomplete disabl ...

Tips on adjusting the dimensions of material-ui's tabs

Is it possible to customize the width of tabs in material-ui so they don't take up 100% of the page width? I've tried adjusting the tab widths using the style property, but the inkbar still seems to use percentages based on the selected tab' ...

Update the autohide timer in the Snackbar upon Re-Rendering

Check out my customized snackbar component: <Snackbar open={open} autoHideDuration={2000} onClose={handleClose} anchorOrigin={{ vertical: 'top', horizontal: 'center' }}> <SnackbarContent aria-describedby="message ...

Tips for adjusting the div style when resizing the browser

As I work on a script, I encounter an issue where the style of a div should change when it becomes larger due to resizing. Even though I have come up with a solution for this problem, there are still some inconsistencies. Sometimes the width is reported a ...

Tips for updating React context provider state when a button is clicked

WebContext.js import React, { createContext, Component } from 'react'; export const WebContext = createContext(); class WebContextProvider extends Component { state = { inputAmount: 1, }; render() { return <WebC ...

Display a fancy slideshow that transitions to five new images when the last one is reached

Here is a screenshot of my issue: https://i.stack.imgur.com/duhzn.png Incorporating Bootstrap 3 and FancyBox, I am facing an issue with displaying images in rows. When I reach the last image, clicking on the right arrow should result in sliding to anothe ...

In ReactJS, when you encounter TextField values that are "undefined", it is important to handle them appropriately

I'm a beginner when it comes to ReactJs and Material-UI, so please bear with me if my question seems silly. Currently, I have a file named Main.js which includes the following code snippet: handleChange = (name, event) => { if(event==null) ...

Top method for waiting for material-ui ripples to finish before capturing snapshots

Seeking expert advice from the React Testing Library community on ensuring completion of a Material UI ripple animation before taking a snapshot. We've been experiencing inconsistent test results with our CI servers due to the animation finishing fas ...

Ionic (Angular) experiencing crashes due to numerous HTTP requests being made

My template contains a list of items <ion-list class="ion-text-center"> <div *ngIf="farms$ | async as farmData"> <ion-item (click)="selectFarm(farm)" *ngFor="let farm of farmData" detail=&quo ...

Ways to transfer data from TypeScript to CSS within Angular 6

Trying to work with ngClass or ngStyle, but I'm struggling with passing the value. Here's my current code: strip.component.ts import { ... } from '@angular/core'; @Component({ selector: 'app-strip', templateUrl: &apo ...

Encountering a problem with indexing when attempting to include dynamic input text within a form in Angular 6

Whenever I click the "Add" button, a dynamic input text box is added to the form. However, if I remove any input box (except for the last one), the second-to-last input box becomes empty. I'm not sure what the issue might be. Here is the HTML section ...