Tooltips

Tooltip puts a small label above (or beside) an element on hover. It is pure CSS via data-tip — no JavaScript, so it works in every rendering mode.

Tooltip
<DTooltip Tip="Hi, there! I'm a tooltip">
    <button class="btn btn-primary">Hover me</button>
</DTooltip>
Positions— tooltip-top is the default; use tooltip-bottom/left/right
<DTooltip Tip="Top" Position="DaisyTooltipPosition.Top"><button class="btn">top</button></DTooltip>
<DTooltip Tip="Bottom" Position="DaisyTooltipPosition.Bottom"><button class="btn">bottom</button></DTooltip>
<DTooltip Tip="Left" Position="DaisyTooltipPosition.Left"><button class="btn">left</button></DTooltip>
<DTooltip Tip="Right" Position="DaisyTooltipPosition.Right"><button class="btn">right</button></DTooltip>
Colors— any text-* class colors the bubble
@foreach (var color in new[] { DaisyColor.Primary, DaisyColor.Secondary, DaisyColor.Accent, DaisyColor.Info, DaisyColor.Success, DaisyColor.Warning, DaisyColor.Error })
{
    <DTooltip Tip="@Name(color)" Class="@($"text-{Name(color).ToLowerInvariant()}")">
        <button class="@($"btn btn-{Name(color).ToLowerInvariant()}")">@color</button>
    </DTooltip>
}
 
@code {
    private static string Name(DaisyColor color) => color switch
    {
        DaisyColor.Primary => "Primary",
        DaisyColor.Secondary => "Secondary",
        DaisyColor.Accent => "Accent",
        DaisyColor.Info => "Info",
        DaisyColor.Success => "Success",
        DaisyColor.Warning => "Warning",
        DaisyColor.Error => "Error",
        _ => "Neutral"
    };
}
Always visible— tooltip-open keeps it shown (demo/touch)
<DTooltip Tip="Always here!" Open="true">
    <button class="btn btn-ghost btn-circle text-2xl">&#9432;</button>
</DTooltip>
On plain text

Blazor supports

several render modes
for the same component tree.

<p class="max-w-prose">
    Blazor supports
    <DTooltip Tip="RenderFragment, to be precise">
        <span class="underline decoration-dotted cursor-help">several render modes</span>
    </DTooltip>
    for the same component tree.
</p>

API

DTooltip

Parameters

Name Type Default Binding Description
Tip string — — The tooltip text. Keep it short; it is rendered as a CSS pseudo-element.
Position DaisyTooltipPosition Top — Which side the tooltip appears on. Top is the default.
TopBottomLeftRight
Open bool False — Forces the tooltip to stay visible ( tooltip-open ), useful for demos and touch devices.
ChildContent RenderFragment — — The element the tooltip is attached to.
Class string — — Additional CSS classes appended to the component's computed daisyUI classes.
Style string — — Inline styles applied to the root element.
Connection lost — reconnecting…
Connection failed.
The server has stopped.