How can I change the mat-select-arrow to another icon, besides the default dropdown?
I've tried various iterations of
.mat-select-arrow {
icon: url('/assets/images/keyboard_arrow_down.png');
content: icon;
}
Chrome developer tool's compute window does not seem to list any property that corresponds to the arrow type.
to the component style's sheet or the styles. scss of your angular app. Caution this will remove every arrow in mat-select. if you want to remove arrow for a few ones just add a class to mat-form-field and nest your class in the scss file.
assume you are using this:
https://material.angular.io/components/select/overview
The Arrow here is made with pure css:
::ng-deep .mat-select-arrow {
width: 0;
height: 0;
border-left: 5px solid transparent;
border-right: 5px solid transparent;
border-top: 5px solid;
margin: 0 4px;
}
to changes this, override the border values and set a background-image
Edit: add ::ng-deep
; see comment from @Ruben Szekér
I had the same issue, I solved by following this procedure.
At first, I hide the mat-arrow by adding below this line of .css into component.css
::ng-deep .mat-select-arrow { opacity: 0; }
And then, I have added the matIcon after the matselect but inside the MatFormField.
<mat-icon matSuffix>domain</mat-icon>
or. You can add your custom Icon URL image by adding the border-images-source
Thanks
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With