How to change angular material sort icon

前端 未结 6 1098
半阙折子戏
半阙折子戏 2021-01-12 06:27

I need to change default arrow icon from angular material matSort to a custom arrow.

The current code

 

        
6条回答
  •  再見小時候
    2021-01-12 06:47

    Try this.
    app.component.ts
    
    import {Component, ViewEncapsulation} from '@angular/core';
    
    @Component({
      selector: 'app-root',
      templateUrl: './app.component.html',
      styleUrls: ['./app.component.css'],
      encapsulation: ViewEncapsulation.None
    })
    export class AppComponent {
      title = 'app';
    }
    
    
    app.component.css
    
        .mat-sort-header-stem {
        height: 3px !important;
        width: 10px !important;
        transform: rotate(180deg) !important;
    }
    .mat-sort-header-pointer-left, .mat-sort-header-pointer-right {
        width: 7px !important;
        height: 3px !important;
    }
    .mat-sort-header-pointer-middle{
        width: 0px !important;
        height: 0px !important;
    }
    

提交回复
热议问题