Search code examples
cssangularangular-materialangular6

How do I increase the size of arrow in mat-accordion


I'm using mat accordion and I want to increase the size of the arrow.
I'm trying to increase the size using font-size and width but it's not working

currently, my font-size:30px;

<mat-accordion>
    <mat-expansion-panel>
        <mat-expansion-panel-header [expandedHeight]="'51px'">
            <mat-panel-title>
                Company Details
            </mat-panel-title>
        </mat-expansion-panel-header>
    </mat-expansion-panel>
    <mat-expansion-panel (opened)="panelOpenState = true"
     (closed)="panelOpenState = false">
        <mat-expansion-panel-header>
            <mat-panel-title>
                Company's Addresses Details
            </mat-panel-title>
        </mat-expansion-panel-header>
        <app-settings-addresses [linkElementDetails]="addressDetails">
        </app-settings-addresses>
    </mat-expansion-panel>
</mat-accordion>

Solution

  • Approach 1 :

    As ::after property is used with selector .mat-expansion-indicator, you can manipulate the height and width for achieving your desired size icon.

    .mat-expansion-indicator::after {
        height: 10px; <======== adjust accordingly
        width: 10px; <======== adjust accordingly
    }
    


    Approach 2 :

    you can use background-image property to handle any icon from url.

    .mat-expansion-indicator::after {
         height: 20px;
        width: 20px;
        background-image: url(https://img.icons8.com/material/24/000000/plus.png);
        background-size: cover;
        border: none;
        border-width: 0 !important;
        transform: rotate(0) !important;
    }
    

    Demo - showing bigger icon on expansion panel (with both approaches)