Change the floating label color of the TextBox in Angular
26 Oct 20242 minutes to read
You can change the floating label color of the TextBox for both success
and warning
validation states by applying the following CSS styles.
/* For Success state */
.e-float-input.e-input-group.e-success label.e-float-text,
.e-float-input.e-input-group.e-success input:focus ~ label.e-float-text,
.e-float-input.e-input-group.e-success input:valid ~ label.e-float-text {
color: #22b24b;
}
/* For Warning state */
.e-float-input.e-input-group.e-warning label.e-float-text,
.e-float-input.e-input-group.e-warning input:focus ~ label.e-float-text,
.e-float-input.e-input-group.e-warning input:valid ~ label.e-float-text {
color: #ffca1c;
}
import { FormsModule } from '@angular/forms'
import { Component } from '@angular/core';
import { TextBoxModule } from '@syncfusion/ej2-angular-inputs';
@Component({
imports: [
TextBoxModule,
FormsModule
],
standalone: true,
selector: 'app-root',
template: `<div class="wrap">
<ejs-textbox placeholder="Success" floatLabelType="Auto" cssClass="e-success"></ejs-textbox>
<ejs-textbox placeholder="Warning" floatLabelType="Auto" cssClass="e-warning"></ejs-textbox>>
</div>`
})
export class AppComponent {
}
import { bootstrapApplication } from '@angular/platform-browser';
import { AppComponent } from './app.component';
import 'zone.js';
bootstrapApplication(AppComponent).catch((err) => console.error(err));