Blog/Components/_Shared/Panel.razor 976 B · 36 lines · raw · history

1 @* A bordered box with a title: docs, dialog bodies, grouped controls. *@
2
3 <fieldset class="panel">
4 @if (Legend is not null || LegendContent is not null || LegendId is not null)
5 {
6 <legend id="@LegendId">
7 @if (LegendContent is not null)
8 {
9 @LegendContent
10 }
11 else
12 {
13 @Legend
14 }
15 </legend>
16 }
17 @ChildContent
18 </fieldset>
19
20 @code {
21 /// <summary>Plain text title. Ignored when <see cref="LegendContent"/> is set.</summary>
22 [Parameter]
23 public string? Legend { get; set; }
24
25 /// <summary>Title markup, for when the legend holds more than text.</summary>
26 [Parameter]
27 public RenderFragment? LegendContent { get; set; }
28
29 /// <summary>Set when script needs to fill the legend in at runtime.</summary>
30 [Parameter]
31 public string? LegendId { get; set; }
32
33 [Parameter]
34 public RenderFragment? ChildContent { get; set; }
35
36 }