Search code examples
paddingmudblazor

MudBlazor: How to remove padding from TitleContent in MudExpansionPanel


Looking to align TitleContent with ChildContent left. This expansion panel is in a tight space and I'd like to remove the gutters on the title content but DisableGutters only seems to apply to ChildContent:

Screenshot

TryMudblazor: https://try.mudblazor.com/snippet/QEQwYmkTgJGCChXP

Thanks in advance!


Solution

  • From GitHub MudBlazor Discussions:

    You have to use CSS to call out the mud-expand-panel-header class

    <style>
        .my-panels .mud-expand-panel-header { padding: 0px; }
    </style>
    
    <MudExpansionPanels Class="my-panels" Elevation="0" DisableGutters="true" Dense="true">
        <MudExpansionPanel Dense="true" Style="padding: 0px;">
            <TitleContent>
                    <MudText Class="mud-text-primary">$[ItemPrice1] [ItemPrice1Label]</MudText>
            </TitleContent>
            <ChildContent>
                    <MudText Class="mud-text-primary">$[ItemPrice2] [ItemPrice2Label]</MudText>
                    <MudText Class="mud-text-primary">$[ItemPrice3] [ItemPrice3Label]</MudText>
            </ChildContent>
        </MudExpansionPanel>
    </MudExpansionPanels>