@* Clickable "?" button that reveals an explanatory tooltip. Use to demystify SharePoint
jargon for users with limited SharePoint knowledge. Pass the explanation via Text
(typically a localized string: ). Click toggles the
bubble; it closes on a second click or when focus leaves the button. *@
@if (!string.IsNullOrWhiteSpace(Text))
{
@Text
}
@code {
/// The explanation shown inside the tooltip bubble.
[Parameter] public string? Text { get; set; }
/// Use a wider bubble for longer explanations.
[Parameter] public bool Wide { get; set; }
private bool _open;
private void Toggle() => _open = !_open;
// Delay the close so a click that moves focus off the button still toggles cleanly,
// and so the bubble doesn't vanish before a click on it registers.
private async Task Close()
{
await Task.Delay(150);
_open = false;
StateHasChanged();
}
}