Customize the textbox background color and text color in Angular Textbox component

21 Sep 20222 minutes to read

You can customize the textbox styles such as background-color, text-color and border-color by overriding its default styles.

To change the styles of the floating label, you must override the style to the input element.

import { Component } from '@angular/core';

    selector: 'app-root',
    template: `<div class="wrap">
                <label> Normal Input </label>
                <div class="e-input-group">
                    <input (focus)="focusIn($" (blur)="focusOut($" class="e-input" type="text" placeholder="First Name">
                 <label> Floating Input </label>
                <div class="e-float-input">
                    <input (focus)="focusIn($" (blur)="focusOut($" type="text" required>
                    <span class="e-float-line"></span>
                    <label class="e-float-text">Last Name</label>

export class AppComponent {
    public focusIn(target: any): void {

    public focusOut(target: any): void {
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { AppComponent } from './app.component';

 * Module
    imports: [
    declarations: [AppComponent],
    bootstrap: [AppComponent]
export class AppModule { }
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
import { enableProdMode } from '@angular/core';
import { AppModule } from './app.module';