microsoft / fluentui-blazor

Microsoft Fluent UI Blazor components library. For use with ASP.NET Core Blazor applications

Home Page:https://www.fluentui-blazor.net

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

FluentToolTip - Add ChildContent RenderFragment as it's trigger element

mpcham opened this issue Β· comments

πŸ™‹ Feature Request

When using the FluentToolTip Component, you have to link the FluentToolTip component to it's trigger element via an AnchorId & element Id pair. When you have lots of tooltips on a page this can be a cumbersome overhead.

This original functionality certainly has great use cases, but is it also possible to have the FluentToolTip as a wrapper of it's trigger element instead of supplying the Text of the FluentToolTip. Maybe having a property on the FluentToolTip to determine which method you're using would help the component check the necessary parameters are supplied?

πŸ’» Examples

Suggestion to add alongside the existing below:

<FluentToolTip Text="Whole numbers only">
     <ChildContent>
          <input type="text" />
     </ChildContent>
</FluentToolTip>

Existing:

@string anchorId1 = "anchorId-WholeNumbersOnly";
<input type="text" Id="@anchorId1" />
<FluentToolTip Anchor="@anchorId1">
     <ChildContent>
          <b>Whole numbers only</b>
     </ChildContent>
</FluentToolTip>

This is not currently planned. The Web Component we're using in the background requires the use of AnchorId and, in addition, ChildContent represents the contents of the Tooltip (formattable). We would then have to distinguish a different ChildContent between the Tooltip content and the content of the component(s) to be used, which would change the current behavior.