Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you position mat-datepicker-toggle mat-icon at the end of the date input field

I have tried to search all over the net for some time now and no direct answer to this. I want the toggle icon be placed at the very end of the date input field.

like image 769
Paul Davies Avatar asked Dec 06 '25 14:12

Paul Davies


2 Answers

To position the icon at the end you have to use matSuffix, and if you want it at the beginning, matPrefix.

  <mat-datepicker-toggle matSuffix [for]="rangePicker"></mat-datepicker-toggle>


  <mat-datepicker-toggle matPrefix [for]="rangePicker"></mat-datepicker-toggle>
like image 200
Ihescode Avatar answered Dec 09 '25 14:12

Ihescode


Maybe try the example

<mat-form-field>
  <input matInput [matDatepicker]="picker" placeholder="Choose a date">
  <mat-datepicker-toggle matSuffix [for]="picker"></mat-datepicker-toggle>
  <mat-datepicker #picker></mat-datepicker>
</mat-form-field>
like image 23
Norbert Bartko Avatar answered Dec 09 '25 15:12

Norbert Bartko



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!