1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Anuncie Aqui
    Anuncie aqui você Também: fdantas@4each.com.br

How do I remove the Clear button from p-calendar?

Discussão em 'Angular' iniciado por twosouth, Julho 2, 2025.

  1. twosouth

    twosouth Guest

    I'm implementing PrimeNG's p-calendar in an Angular application and I'm using the showButtonBar property. I need the Today button to show, but I do not want the Clear button.

    I'm not having any luck using clearButtonStyleClass in conjunction with a CSS class to just hide the button directly.

    Here's my implementation:

    `<p-calendar
    [style]="{'width': '100%'}"
    [inputStyle]="{'width': '100%', 'border': 'none', 'cursor': 'pointer'}"
    [(ngModel)]="calendarDate"
    [inline]="false"
    dateFormat="DD, MM d, yy"
    (onSelect)="calendarPickDate($event)"
    [showIcon]="false"
    [showButtonBar]="true"
    (onTodayClick)="returnToTodaysDate()"
    (onClearClick)="returnToTodaysDate()"
    [clearButtonStyleClass]="'clear-button'"
    [readonlyInput]="true"
    </p-calendar>`


    In my CSS for that Angular component, clear-button is as follows:

    .clear-button { display: none; }


    I also don't get any traction by trying this syntax on the class property for the Clear button:

    clearButtonStyleClass="clear-button"

    Continue reading...

Compartilhe esta Página