Tooltip
in namespace DotVVM.BusinessPack.Controls
Usage & Scenarios
Tooltip shows text or formatted content near the pointer when it enters an element with the tooltip-trigger CSS class. The tooltip hides when the pointer leaves.
Sample 1: Showing a text hint
Hover over the reference to display Text. Bind IsDisplayed to a Boolean property to observe when the tooltip opens and closes.
The trigger class is matched across the document. A single tooltip can serve several triggers; placing a tooltip next to an element does not pair them.
<span class="tooltip-trigger">Hover over reference INV-1042</span>
<bp:Tooltip Text="{value: ReferenceHint}" IsDisplayed="{value: HintVisible}" />
<p>Tooltip visible: {{value: HintVisible}}</p>
using DotVVM.Framework.ViewModel;
namespace DotvvmWeb.Views.Docs.Controls.businesspack.Tooltip.sample1
{
public class ViewModel : DotvvmViewModelBase
{
public string ReferenceHint => "Include this reference when contacting support.";
public bool HintVisible { get; set; }
}
}
Sample 2: Formatting tooltip content
Use Template instead of Text to include markup. Hover over the field label to see an example with the prefix emphasized.
<label class="tooltip-trigger">Invoice reference: <input type="text" /></label>
<bp:Tooltip>
<Template>Start with <strong>INV-</strong>, for example <code>INV-1042</code>.</Template>
</bp:Tooltip>
Properties
| Name | Type | Description | Notes | Default Value | |
|---|---|---|---|---|---|
| ClientIDMode | ClientIDMode | Gets or sets the client ID generation algorithm. |
attribute
static value
|
Static | |
| DataContext | Object | Gets or sets a data context for the control and its children. All value and command bindings are evaluated in context of this value. The DataContext is null in client-side templates. |
attribute
bindable
|
null | |
| ID | String | Gets or sets the control client ID within its naming container. |
attribute
static value
bindable
|
null | |
| IncludeInPage | Boolean | Gets or sets whether the control is included in the DOM of the page. |
attribute
static value
bindable
|
True | |
| InnerText | String | Gets or sets the inner text of the HTML element. Note that this property can only be used on HtmlGenericControl directly and when the control does not have any children. |
attribute
static value
bindable
|
null | |
| IsDisplayed | Boolean |
attribute
bindable
|
False | ||
| Template | ITemplate |
inner element
static value
bindable
default
|
null | ||
| Text | String |
attribute
static value
bindable
|
null | ||
| Visible | Boolean | Gets or sets whether the control is visible. When set to false, `style="display: none"` will be added to this control. |
attribute
static value
bindable
|
True |