Label component for field level help

This commit is contained in:
Shaun Walker
2020-03-16 15:06:59 -04:00
parent dc2c46e878
commit 8bc694fe63
8 changed files with 196 additions and 11 deletions

View File

@ -0,0 +1,42 @@
@namespace Oqtane.Modules.Controls
@inherits ModuleBase
@if (!string.IsNullOrEmpty(HelpText))
{
<span class="app-tooltip" data-tip="@((MarkupString)HelpText)">@((MarkupString)_openLabel)@ChildContent@((MarkupString)_closeLabel) <img src="images/help.png" /></span>
}
else
{
@((MarkupString)_openLabel)@ChildContent@((MarkupString)_closeLabel)
}
@code {
string _openLabel = "";
string _closeLabel = "</label>";
[Parameter]
public RenderFragment ChildContent { get; set; } // required - the title of the label
[Parameter]
public string For { get; set; } // optional - the id of the associated input control for accessibility
[Parameter]
public string Class { get; set; } // optional - the class for the label ( ie. control-label )
[Parameter]
public string HelpText { get; set; } // optional - tooltip for this label
protected override void OnParametersSet()
{
_openLabel = "<label";
if (!string.IsNullOrEmpty(For))
{
_openLabel += " for=\"" + For + "\"";
}
if (!string.IsNullOrEmpty(Class))
{
_openLabel += " class=\"" + Class + "\"";
}
_openLabel += ">";
}
}