Skip to content

Commit 1255ee4

Browse files
author
KB Bot
committed
Added new kb article tooltip-show-on-disabled-element
1 parent c6274f4 commit 1255ee4

File tree

1 file changed

+58
-0
lines changed

1 file changed

+58
-0
lines changed
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
---
2+
title: Displaying Tooltip on Disabled HTML Element
3+
description: Learn how to show a tooltip for a disabled element by wrapping it with an HTML element in Blazor applications.
4+
type: how-to
5+
page_title: How to Displaying Tooltip on Disabled HTML Element
6+
slug: tooltip-kb-disabled-element
7+
tags: tooltip, disabled element
8+
res_type: kb
9+
ticketid: 1665023
10+
---
11+
12+
## Environment
13+
14+
<table>
15+
<tbody>
16+
<tr>
17+
<td>Product</td>
18+
<td>Tooltip for Blazor</td>
19+
</tr>
20+
</tbody>
21+
</table>
22+
23+
## Description
24+
25+
When an HTML element is disabled, providing additional information via a Tooltip can be challenging since disabled elements do not respond to mouse events. Hence, the Tooltip cannot detect when the user hovers over a disabled element.
26+
27+
This knowledge base article also answers the following questions:
28+
- How can I display a tooltip over a disabled HTML element in Blazor?
29+
- How to display a tooltip over a disabled button?
30+
- What is the workaround for showing tooltips on disabled elements in Blazor?
31+
- Can a tooltip be associated with a disabled element in Blazor applications?
32+
33+
## Solution
34+
35+
To display a Tooltip for a disabled button, wrap the disabled button within another HTML element, like a `<div>`, and then set the Tooltip to target this wrapper element. This approach allows the Tooltip to be activated when the user hovers over the area covering the disabled button.
36+
37+
Here's an example demonstrating how to implement this solution:
38+
39+
CSHTML````
40+
<div class="disabled-button" style="width: fit-content;">
41+
<TelerikButton Enabled="false">Hover me</TelerikButton>
42+
</div>
43+
44+
<TelerikTooltip TargetSelector=".disabled-button">
45+
<Template>
46+
@{
47+
<h6>
48+
<strong>Disabled button</strong>
49+
</h6>
50+
}
51+
</Template>
52+
</TelerikTooltip>
53+
````
54+
55+
## See Also
56+
57+
- [Tooltip Component Overview]({%slug tooltip-overview%})
58+
- [Button Component Overview]({%slug components/button/overview%})

0 commit comments

Comments
 (0)