Closed alexciesielski closed 3 months ago
@alexciesielski maybe we can support both? I'd like to keep the template way to support something like adding a button. But I also see that it's a lot easier to simply pass in a string and call it a day
Yes, that is what I'm suggesting.
Keep the existing functionality but add a way to simply pass in a string and call it a day (like matTooltip
does it)
So can I go ahead with this? Or will it end up like the table PR? 😅
No you can go ahead and add this. Still owe you a review/decision with that. Haven't had much toke to spend on spartan lately, unfortunately.
Would you have anything against renaming hlmTooltipTrigger
to just hlmTooltip
? Similar to matTooltip
?
It looks weird to me to pass a string to the trigger, and it would be aligned with how Material does it, too.
Also I'm not sure if we even need to wrap the whole thing inside a hlm-tooltip
component for when using a TemplateRef
? It should be possible to just pass it into the directive and have it handle everything? Or is there something I am missing for what the wrapping component does?
My proposal would be to just have a single brn/hlmTooltip
directive, that takes both a string
and a TemplateRef
and renders them, without having to wrap the whole thing in another hlm-tooltip
component.
We are taking this approach to mimic the RadixUI behavior. Personally, I also prefer it because it let's me avoid having an ng-template
with a ref to it, which I pass to the tooltip. I am open to supporting both, but want to keep the hlm-tooltip for now to stay consistent with this approach we used in other components.
Which scope/s are relevant/related to the feature request?
tooltip
Information
Currently to show a tooltip on a button I:
hlm-tooltip
componentspan
element and apply thebrnTooltip
structural directive on ithlmTooltipTrigger
to the buttonVery complex, deeply nested and you need to know exactly which type of directive (hlm vs brn) to apply where.
Proposal
I know I'm gonna sound like a stuck CD on repeat, but Material's API is much more comfortable in this regard. Simply apply the
[matTooltip]
directive to the button and it's done.Obviously the
HlmTooltip
allows for defining any template, also icons, for the tooltip, which is something I like and would definitely want to keep.But for the majority of cases where I just want to apply a quick tooltip to a icon button (hence no icon in the tooltip needed) for which, I think, Material's approach is superior.
Describe any alternatives/workarounds you're currently using
No response
I would be willing to submit a PR to fix this issue