Css customization in Angular Datepicker component
27 Apr 20244 minutes to read
To customize DatePicker UI, you can make use of cssClass
which will be added to DatePicker component as the root CSS class. With this CSS class, you can override existing styles of DatePicker.
Following is the list of classes that provides flexible way to customize the DateRangePicker component.
Class Name | Description |
---|---|
e-date-wrapper | Applied to DatePicker wrapper element. |
e-datepicker | Applied to input element and DatePicker popup element. |
e-datepicker .e-date-wrapper | Applied to input element only. |
e-input-group-icon.e-date-icon | Applied to popup icon button. |
e-float-text | Applied to floating label text element. |
e-popup | Applied to popup element. |
e-datepicker.e-popup | Applied to DatePicker popup element only. |
e-header | Applied to Calendar header. |
e-title | Applied to Calendar title. |
e-icon-container | Applied to Calendar previous and next icon container. |
e-prev | Applied to Calendar previous icon. |
e-next | Applied to Calendar next icon. |
e-weekend | Applied to Calendar weekend dates. |
e-other-month | Applied to Calendar other month dates. |
e-day | Applied to each day cell of the Calendar. |
e-selected | Applied to Calendar selected dates. |
e-disabled | Applied to Calendar disabled dates. |
e-footer-container | Applied to the Calendar footer container. |
e-today | Applied to the Calendar Today Cell. |
import { NgModule } from '@angular/core'
import { BrowserModule } from '@angular/platform-browser'
import { DatePickerModule } from '@syncfusion/ej2-angular-calendars'
import { Component } from '@angular/core';
@Component({
imports: [
DatePickerModule
],
standalone: true,
selector: 'app-root',
styleUrls: ['./index.css'],
template: `<ejs-datepicker [value]='dateValue' [cssClass]='cssClass' placeholder='Enter date' (renderDayCell)='onRenderCell($event)'></ejs-datepicker>`
})
export class AppComponent {
onRenderCell($event: any) {
throw new Error('Method not implemented.');
}
public cssClass: string = 'e-custom-style';
dateValue: any;
}
import { bootstrapApplication } from '@angular/platform-browser';
import { AppComponent } from './app.component';
import 'zone.js';
bootstrapApplication(AppComponent).catch((err) => console.error(err));