@inherits DComponentBase @* daisyUI FAB: https://daisyui.com/components/fab/ . Opening is daisyUI's own :focus-within rule (there is no open-state class): the trigger is the focusable first child, and focus moving out of the FAB closes it. The order of the children matters to daisyUI: trigger, then Close or MainAction, then the speed-dial items (ChildContent, e.g. DButton Size="DSize.Lg" Shape="DButtonShape.Circle", optionally inside a
with a text label). *@
@Trigger
@if (Close is not null) {
@Close
} @if (MainAction is not null) {
@MainAction
} @ChildContent
@code { /// Content of the button shown while closed, usually an icon. [Parameter] public RenderFragment Trigger { get; set; } /// Accessible name of the trigger (aria-label), since it usually holds only an icon. [Parameter] public string LabelText { get; set; } [Parameter] public DColor Color { get; set; } = DColor.Primary; [Parameter] public string TriggerClass { get; set; } /// Replaces the trigger while open; clicking it closes the FAB. Not focusable, e.g. a text label and a /// <span class="btn btn-circle btn-lg">. [Parameter] public RenderFragment Close { get; set; } /// Replaces the trigger while open with a main action, e.g. a label and a button. [Parameter] public RenderFragment MainAction { get; set; } /// The speed-dial items. [Parameter] public RenderFragment ChildContent { get; set; } /// Arrange the items in a quarter circle (fab-flower) instead of a column. [Parameter] public bool Flower { get; set; } string CssClass => Cx("fab", Flower ? "fab-flower" : null, Class); string ColorClass => Color switch { DColor.Neutral => "btn-neutral", DColor.Primary => "btn-primary", DColor.Secondary => "btn-secondary", DColor.Accent => "btn-accent", DColor.Info => "btn-info", DColor.Success => "btn-success", DColor.Warning => "btn-warning", DColor.Error => "btn-error", _ => null }; }