@inherits DComponentBase
@* daisyUI Tooltip: https://daisyui.com/components/tooltip/ . Shows on hover or keyboard focus of ChildContent: Tip
sets data-tip, or TipContent renders a tooltip-content part for markup. IsOpen keeps it shown (tooltip-open). *@
@if (TipContent is not null)
{
@TipContent
}
@ChildContent
@code {
[Parameter] public RenderFragment ChildContent { get; set; }
[Parameter] public string Tip { get; set; }
[Parameter] public RenderFragment TipContent { get; set; }
[Parameter] public DTooltipPlacement Placement { get; set; }
[Parameter] public DTooltipAlign Align { get; set; }
/// Neutral is the default look; daisyUI has no tooltip-neutral.
[Parameter] public DColor Color { get; set; }
[Parameter] public bool IsOpen { get; set; }
string CssClass => Cx("tooltip", PlacementClass, AlignClass, ColorClass, IsOpen ? "tooltip-open" : null, Class);
string PlacementClass => Placement switch
{
DTooltipPlacement.Bottom => "tooltip-bottom",
DTooltipPlacement.Left => "tooltip-left",
DTooltipPlacement.Right => "tooltip-right",
_ => null
};
string AlignClass => Align switch
{
DTooltipAlign.Start => "tooltip-start",
DTooltipAlign.End => "tooltip-end",
_ => null
};
string ColorClass => Color switch
{
DColor.Primary => "tooltip-primary",
DColor.Secondary => "tooltip-secondary",
DColor.Accent => "tooltip-accent",
DColor.Info => "tooltip-info",
DColor.Success => "tooltip-success",
DColor.Warning => "tooltip-warning",
DColor.Error => "tooltip-error",
_ => null
};
}