@inherits DComponentBase
@* daisyUI Button: https://daisyui.com/components/button/ . Renders an when Href is set. *@
@if (Href is null)
{
}
else
{
@ChildContent
}
@code {
[Parameter] public RenderFragment ChildContent { get; set; }
[Parameter] public DColor Color { get; set; }
[Parameter] public DButtonVariant Variant { get; set; }
[Parameter] public DSize Size { get; set; }
[Parameter] public DButtonShape Shape { get; set; }
/// Pressed look (btn-active); the neo theme renders it inset.
[Parameter] public bool Active { get; set; }
[Parameter] public bool Disabled { get; set; }
[Parameter] public string Type { get; set; } = "button";
[Parameter] public string Href { get; set; }
[Parameter] public EventCallback OnClick { get; set; }
string CssClass => Cx("btn", ColorClass, VariantClass, SizeClass, ShapeClass,
Active ? "btn-active" : null, Disabled && Href is not null ? "btn-disabled" : 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
};
string VariantClass => Variant switch
{
DButtonVariant.Outline => "btn-outline",
DButtonVariant.Dash => "btn-dash",
DButtonVariant.Soft => "btn-soft",
DButtonVariant.Ghost => "btn-ghost",
DButtonVariant.Link => "btn-link",
_ => null
};
string SizeClass => Size switch
{
DSize.Xs => "btn-xs",
DSize.Sm => "btn-sm",
DSize.Lg => "btn-lg",
DSize.Xl => "btn-xl",
_ => null
};
string ShapeClass => Shape switch
{
DButtonShape.Wide => "btn-wide",
DButtonShape.Block => "btn-block",
DButtonShape.Square => "btn-square",
DButtonShape.Circle => "btn-circle",
_ => null
};
}