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

How to fetch and display data for a selected item in React-Admin AutocompleteInput

I have the following code snippet in React-Admin v3 <AutocompleteInput onSelect={(value) => { setCurrentCategory({ reference: value.id }); }} Upon upgrading to v4, AutocompleteInput now utilizes MUI in ...

Show content when box is ticked

I am looking to display a row of text when a checkbox is checked, but I am finding it challenging as a beginner in this. Despite trying to understand other answers, I still struggle with the process. Here is what I have attempted so far: function RiskPl ...

In search of a mobile web UI framework solely built with CSS styling

Currently in search of a CSS framework that specializes in styling form elements and lists for optimal small screen use. The ideal framework must be CSS only, requiring minimal to no JavaScript. Something along the lines of Twitter Bootstrap would be per ...

Animating CSS using JavaScript

Recently diving into the world of JavaScript, I've taken on the challenge of creating an analog clock. I began by crafting the second hand using CSS but now I'm eager to transition it to Javascript without relying on jQuery or any other JS framew ...

Gather information that is dynamic upon the selection of a "li" option using Python Selenium

I need to extract data from this website (disregard the Hebrew text). To begin, I must choose one of the options from the initial dropdown menu below: https://i.stack.imgur.com/qvIyN.png Next, click the designated button: https://i.stack.imgur.com/THb ...

I encountered an issue trying to locate the module '@angular/compiler-cli'

I've encountered an issue with my new project as it's not allowing me to run 'ng serve' due to the 'cannot find module @angular/compiler-cli' error. Despite trying to clear the cache and deleting the node_modules folder withi ...

Creating a unique custom bottom position for the popover and ensuring it is fixed while allowing it to expand

Creating a customized popover similar to Bootstrap's popover, I have successfully implemented popovers in all directions except for the top direction. My challenge lies in fixing the popover at the bottom just above the button that triggers it, and en ...

Make sure the static variable is set up prior to injecting the provider

In our Angular6 application, we utilize a globalcontextServiceFactory to initialize the application before rendering views. This process involves subscribing to get configuration from a back-end endpoint and then using forkJoin to retrieve environment app ...

What is the best way to save multiple HTML widgets in my HTML file using R and plot.ly?

I have recently started experimenting with plot.ly in R and I am fascinated by the ability to easily publish graphs directly in html using htmlwidgets. However, I have encountered a challenge when trying to save multiple widgets in the same html file. Curr ...

Tips for integrating an angular module that lacks Universal compatibility into an angular/cli application with server-side rendering (SSR) support

Greetings everyone! I've been working on developing an Angular app that utilizes Universal with SSR for quite some time now. At times, while including a module like ngx-editor, I noticed that the server would fail silently without any indication of wh ...

Assign a CSS class to a specific option within a SelectField in a WTForms form

Could someone explain the process of assigning a CSS class to the choices values? I am looking to customize the background of each choice with a small image. How can this be done using wtforms and CSS? class RegisterForm(Form): username = TextField( ...

The grid area may not properly adjust based on the width size of the browser

When adjusting the width of your browser, you may notice occasional white space in the bottom right corner. https://i.stack.imgur.com/UFV6R.png https://i.stack.imgur.com/VfhMN.png Is there a way to remove this extra margin? In other words, how can I ens ...

Personalized design for the range input in React

I am working on a React component that includes an input range element. I have used some CSS to style it vertically and currently, it looks like this: https://i.stack.imgur.com/WmQP4.png My goal is to customize the appearance of the slider so that it res ...

The process of masking a video with alpha data from another video on canvas seems to be experiencing a

I have a unique setup on my page where I'm masking one video with another. Essentially, when the Play button is pressed, a second video slowly appears over the looping video in the background. This effect is achieved by using a black/white mask transf ...

Enhancing HTML through Angular 7 with HTTP responses

Sorry to bother you with this question, but I could really use some help. I'm facing an issue with updating the innerHTML or text of a specific HTML div based on data from an observable. When I try to access the element's content using .innerHTM ...

What's the best way to ensure that the theme state remains persistent when navigating, refreshing, or revisiting a page in the browser?

Is there a way to ensure that my light/dark theme settings remain persistent when users reload the page, navigate to a new page, or use the browser's back button? The current behavior is unreliable and changes unexpectedly. This is the index.js file ...

Can you explain the distinction between ' &:hover' and ' & :hover' pseudoclass selectors?

While styling a Material-UI Button, I encountered an unexpected behavior when adding hover effects. When using & :hover, only the inner span of the button was affected. However, when using &:hover, the desired style was achieved. What is the diff ...

Exploring the ins and outs of data exchange within Angular 2

I'm currently in the process of developing an angular2 application. One of the components in my project is the MountainListComponent, which is composed of other components (although this detail is not crucial) and is nested within a parent component. ...

Utilizing stored procedures to send JSON data to Angular application

Our team is currently in the process of creating a cutting-edge browser-based user interface for our comprehensive enterprise system using Angular.js paired with the Infragistics toolset. The ASP.NET Core Web API serves as the conduit for exchanging JSON d ...

Encountered an error while trying to run the command "lite-server" in Angular 2

I recently had a machine where I installed Zsh and OhMyZsh, but later on uninstalled them. However, now whenever I try to run "npm start" on the Angular 2 Quick Starter template, I keep encountering this error message: Error occurred when executing comma ...