How to customize the ngx-bootstrap datepicker


I want to customize the ngx-bootstrap datepicker popup. Basically I want to add link/button in the calendar showing date and on click of that date will get added to date picker field.

I couldn’t find any way to customize the datepicker. I am using Angular 5 and ngx-bootstrap:

Thanks in advance.


You could create a custom component based on the original datepicker adding custom element to template making it look like an integrated element with some css :

enter image description here

First change the height of the datepicker popup : {
  height: 350px;

Then add the custom element to the datepicker :

<div class="container">
    <input type="text" #dp="bsDatepicker" bsDatepicker [(bsValue)]="myDateValue">
    <div class="custom-content" *ngIf="dp.isOpen">
        <a (click)="customAction()">{{myDateValue | date:'short'}}</a>

With some css :

.custom-content {
  position: absolute;
  z-index: 1081;
  top: 390px;
  cursor: pointer;
  align-self: center;

Here is a running stackblitz demo.

A better solution would be to have the possibility to pass a template to the datepicker, but ngx-bootstrap doesn’t seem to support that.

Answered By – ibenjelloun

Answer Checked By – Terry (AngularFixing Volunteer)

Leave a Reply

Your email address will not be published.