Showcase

Blazor Tooltip

Use Blazor Bootstrap tooltip component to add custom tooltips to your web pages. The examples below cover disabled button with tooltip, icon with click event, dynamically update the tooltip text, tooltip with link and custom tooltips.
API Documentation

Examples #

Tooltip Left Tooltip Top Tooltip Right Tooltip Bottom
Razor
<Tooltip Class="me-4" Title="Tooltip Left" Placement="TooltipPlacement.Left">Tooltip Left</Tooltip>
<Tooltip Class="me-4" Title="Tooltip Top">Tooltip Top</Tooltip>
<Tooltip Class="me-4" Title="Tooltip Right" Placement="TooltipPlacement.Right">Tooltip Right</Tooltip>
<Tooltip Class="me-4" Title="Tooltip Bottom" Placement="TooltipPlacement.Bottom">Tooltip Bottom</Tooltip>

Disabled button with tootip #

Razor
<Tooltip Class="d-inline-block" Title="Disabled button"role="button">
    <button class="btn btn-primary" type="button" disabled>Disabled button</button>
</Tooltip>
TIP
By default, Button supports tooltips via TooltipTitle and TooltipPlacement parameters. See Buttons - Tooltip.

Icon with click event #

Razor
<Tooltip Title="Click here" @onclick="OnClick" role="button">
    <i class="bi bi-arrow-repeat text-danger"></i>
</Tooltip>

@code{
    private void OnClick()
    {
        Console.WriteLine($"clicked");
    }
}

Custom tooltips #

Blazor Bootstrap includes several predefined tooltip styles, each serving its own semantic purpose. The Color parameter can be used to customize the color of the tooltip.

Dynamically change the tooltip color #

Tooltip Top

Razor
<Tooltip Title="@title" Color="@tooltipColor">Tooltip Top</Tooltip>

<br/>
<br />

<Button Color="ButtonColor.Primary" @onclick="UpdateTooltipToPrimary">Change Tooltip Color</Button>
<Button Color="ButtonColor.Success" @onclick="UpdateTooltipToSuccess">Change Tooltip Color</Button>
<Button Color="ButtonColor.Danger" @onclick="UpdateTooltipToDanger">Change Tooltip Color</Button>

@code {
    private string? title = "Tooltip Top";
    private TooltipColor tooltipColor;

    private void UpdateTooltipToPrimary()
    {
        tooltipColor = TooltipColor.Primary;
        title = "Tooltip Top Primary";
    }

    private void UpdateTooltipToSuccess()
    {
        tooltipColor = TooltipColor.Success;
        title = "Tooltip Top Success";
    }

    private void UpdateTooltipToDanger()
    {
        tooltipColor = TooltipColor.Danger;
        title = "Tooltip Top Danger";
    }
}

Clear the tooltip text #

Set the Title parameter to an empty string or null to stop showing the tooltip. Set it again to show the new text.
Hover me
Razor
<div class="mb-3">
    <Tooltip Title="@title">Hover me</Tooltip>
</div>

<Button Color="ButtonColor.Primary" @onclick="SetTooltip">Set Tooltip</Button>
<Button Color="ButtonColor.Secondary" @onclick="ClearTooltip">Clear Tooltip</Button>

@code {
    private string? title = "Tooltip text";

    private void SetTooltip() => title = $"Updated {DateTime.Now.ToLongTimeString()}";

    private void ClearTooltip() => title = string.Empty;
}

Tooltip with HTML #

Tooltip with HTML
Razor
<Tooltip Class="me-4" Title="<strong>Tooltip</strong> <em>with</em> <u>HTML</u>" IsHtml="true">Tooltip with HTML</Tooltip>

Rejoining the server...

Rejoin failed... trying again in seconds.

Failed to rejoin.
Please retry or reload the page.

The session has been paused by the server.

Failed to resume the session.
Please reload the page.