<SfTooltip ID="@(ID + "-tooltip")" @ref="@tooltip"
Target="@("#" + ID)" OpensOn="Hover" OnOpen="OnOpen"
Width="@Width">
<SfTextBox ID="@ID" @bind-Value="@CurrentValueAsString"
Placeholder="@Placeholder" Width="@Width" Readonly="@Readonly" FloatLabelType='@FloatLabelType.Auto' />
<TooltipTemplates>
<Content>
@ValidationTemplate
</Content>
</TooltipTemplates>
</SfTooltip> |
<div>
<SfTooltip ID="@(ID + "-tooltip")" @ref="@tooltip"
Target="@("#" + ID)" OpensOn="Hover"
Width="@Width">
<SfTextBox ID="@ID"
Placeholder="@Placeholder" Width="@textboxwidth" FloatLabelType='@FloatLabelType.Auto' />
<TooltipTemplates>
<Content>
@ValidationTemplate
</Content>
</TooltipTemplates>
</SfTooltip>
</div>
@code {
SfTooltip tooltip;
public string ID = "textbox";
public string Width = "50px";
public string textboxwidth = "150px";
public string ValidationTemplate = "tooltip";
public string Placeholder = " First Name";
public string CurrentValueAsString { get; set; } = "Syncfusion";
} |
@if (!String.IsNullOrWhiteSpace(Width)) { <style>@("#" + ID + "-tooltip {width:" + Width + ";display: inline-flex;}")</style> } <SfTooltip ID="@(ID + "-tooltip")" @ref="@tooltip" Target="@("#" + ID)" OpensOn="Click" OnOpen="OnOpen"> <SfTextBox ID="@ID" @bind-Value="@CurrentValueAsString" Placeholder="@Placeholder" Width="100%" Readonly="@Readonly" FloatLabelType='@FloatLabelType.Auto' /> <TooltipTemplates> <Content> @ValidationTemplate </Content> </TooltipTemplates> </SfTooltip> |
The given HTML result :
<style>#nom-tooltip {width:calc(100% - 12px);display: inline-flex;}</style> <div id="nom-tooltip" class="e-control e-tooltip e-lib"> <div class="e-input-group e-control-wrapper e-float-input" style="width:100%;"> <input id="nom" class="e-control e-textbox e-lib" aria-labelledby="label_nom" tabindex="0" type="text" role="textbox" name="nom" value=""> <span class="e-float-line"></span> <label class="e-float-text e-label-bottom" id="label_nom" for="nom">Nom</label> </div> </div> |
It seems to me like a dirty hack.
<SfTooltip ID="@(ID + "-tooltip")" @ref="@tooltip"
Target="@("#" + ID)" OpensOn="Click" HtmlAttributes="@attributes">
<SfTextBox ID="@ID" @bind-Value="@CurrentValueAsString"
Placeholder="@Placeholder" Width="@width" FloatLabelType='@FloatLabelType.Auto' />
<TooltipTemplates>
<Content>
@ValidationTemplate
</Content>
</TooltipTemplates>
</SfTooltip>
private Dictionary<string, object> attributes { get; set; } = new Dictionary<string, object>()
{
{ "class", "custom" },
};
<style>
.custom {
width:150px;
}
</style> |
<SfTooltip ID="@(ID + "-tooltip")" @ref="@tooltip"
Target="@("#" + ID)" OpensOn="Click">
<SfTextBox ID="@ID" @bind-Value="@CurrentValueAsString"
Placeholder="@Placeholder" Width="@width" FloatLabelType='@FloatLabelType.Auto' />
<TooltipTemplates>
<Content>
@ValidationTemplate
</Content>
</TooltipTemplates>
</SfTooltip>
<style>
#textbox-tooltip {
padding: 20px;
display: inline-block;
}
</style> |