Files
decePubClient/Components/Daisy/Navigation/DTab.razor
T

21 lines
680 B
Plaintext
Raw Normal View History

@implements IDisposable
@* One tab of a DTabs: renders nothing itself; DTabs renders its Header as the tab button and its ChildContent as
the panel while it is active. *@
@code {
[CascadingParameter] DTabs Parent { get; set; }
[Parameter] public RenderFragment Header { get; set; }
[Parameter] public RenderFragment ChildContent { get; set; }
[Parameter] public bool Disabled { get; set; }
[Parameter] public string Class { get; set; }
protected override void OnInitialized()
{
if (Parent is null)
throw new InvalidOperationException($"{nameof(DTab)} must be inside a {nameof(DTabs)}.");
Parent.Add(this);
}
public void Dispose() => Parent?.Remove(this);
}