I have created a simple Blazor Component for my project that has a button on top and and a conditional rendering where I pass a RenderFragment type. Here the component.
<div class=""><button class="btn btn-link w-100" @onclick="Toggle"><b>GroupTitle</b></button> @if (!ShowContent) {<div> @CollapsibleContent</div> }</div>@code { [Parameter] public string? GroupTitle { get; set; } [Parameter] public RenderFragment CollapsibleContent { get; set; } public bool ShowContent { get; set; } = false; public void Toggle() { ShowContent = !ShowContent; }}My problem is that ONLY the @CollapsibleContentdisplays and not the button! Even when I inspect the web page things look off.Inspected Content on Web Page
I have tried to change some elements and add some simple text to see if it shows up but it does not work.
Here is how I implement the component:
<div class="d-flex flex-row"><div class="d-flex flex-column" style="min-width: 100;"> @foreach(var pair in Menu) {<CollapsibleMenu GroupTitle="@pair.Key"><CollapsibleContent><ul class="list-group"> @foreach(DataRow row in pair.Value) {<li class="list-group-item"> @(row["SortOrder"])</li> }</ul></CollapsibleContent></CollapsibleMenu> }</div></div>