Tooltip
A short hint shown on hover and keyboard focus.
On this page
Examples
Tooltip
Tooltip on the top
Tooltip on the right
Tooltip on the bottom
Tooltip on the left
Razor
<div class="flex flex-wrap items-center gap-3">
@foreach (var placement in new[] { KlyPlacement.Top, KlyPlacement.Right, KlyPlacement.Bottom, KlyPlacement.Left })
{
<KlyTooltip Text="@($"Tooltip on the {PlacementName(placement)}")" Placement="@placement">
<KlyButton Label="@PlacementName(placement)" Color="KlyColor.Neutral" Variant="ButtonVariant.Outline" />
</KlyTooltip>
}
</div>
@code {
private static string PlacementName(KlyPlacement placement) => placement.ToString().ToLowerInvariant();
}API
KlyTooltip
Text label that appears when its trigger is hovered or focused. It is handled in the browser.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
Class |
string |
Classes added to the root element, merged last so they win over the theme. | |
Delay |
int |
300 |
Hover delay before showing, in milliseconds. Keyboard focus shows it at once. |
Placement |
KlyPlacement |
KlyPlacement. |
Where the tooltip sits against the trigger. Defaults to Top . Values: Top, TopStart, TopEnd, Right, RightStart, RightEnd, Bottom, BottomStart, BottomEnd, Left, LeftStart, LeftEnd. |
Text |
string |
Text of the tooltip. Use Content for markup. | |
Ui |
TooltipUi |
Per-instance class overrides of the slots of the tooltip, see TooltipUi . They are merged after the theme and the Class parameter wins on the root slot. |
Slots
| Name | Type | Description |
|---|---|---|
Content |
RenderFragment |
Content of the tooltip, instead of Text . |
ChildContent |
RenderFragment |
The trigger, a focusable element. |
Ui slots
Ui takes a TooltipUi with one class string per slot, merged after the theme.
| Slot | Styles |
|---|---|
Content |
Classes merged into the content slot of KlyTooltip , after the theme and the app configuration. |