2 Tooltip
Byron edited this page 2026-10-02 23:49:06 +02:00

Note

This component uses the built-in Popover API.

Warning

Don't forget to include the tooltip.js file whenever you want to use toasts:

<script src="@(Assets["_content/CleanUI/tooltip.js"])"></script>

Basic

<CleanButton>
	Default
	<CleanTooltip>
		This tooltip is aligned to the top.
	</CleanTooltip>
</CleanButton>

<CleanButton>
	Right
	<CleanTooltip Position="@(CleanPopoverPosition.Right)">
		This tooltip is aligned to the right.
	</CleanTooltip>
</CleanButton>

<CleanButton>
	Bottom
	<CleanTooltip Position="@(CleanPopoverPosition.Bottom)">
		This tooltip is aligned to the bottom.
	</CleanTooltip>
</CleanButton>

<CleanButton>
	Left
	<CleanTooltip Position="@(CleanPopoverPosition.Left)">
		This tooltip is aligned to the left.
	</CleanTooltip>
</CleanButton>

Without a button

Tip

You can attach a tooltip to any HTML element. Keep in mind that it will attach to the first parent that can receive pointer-events.

<div class="border">
	Hover me
	<CleanTooltip>
		This tooltip is attached to a <code>&lt;div&gt;</code>
	</CleanTooltip>
</div>

Show manually

<CleanTooltip id="tooltip">
	This tooltip gets shown manually using JavaScript.
</CleanTooltip>

<CleanButton onclick="window.Tooltip.show('tooltip')">
	Show tooltip
</CleanButton>

Using IJsRuntime

Warning

Using the IJsRuntime requires the Interactive rendering mode.

<CleanTooltip id="tooltip">
	This tooltip gets shown using the IJSRuntime.
</CleanTooltip>

@code {

	[Inject] public required IJSRuntime Js { get; init; }

	protected override async Task OnInitializedAsync()
	{
		await Js.ShowTooltipAsync("tooltip");
	}

}