Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Based on #45
This adds support for tooltips with
popper-rs
.Bootstrap tooltips are built with Popper. Both Yew and Popper assume they have complete control of the DOM, so Popper needs some extra wiring to handle the component lifecycle correctly, which
popper-rs
provides.This takes some ideas from
react-bootstrap
's Tooltip implementation, but goes for a slightly simpler model, where Tooltips are dropped into a portal directly (likepopper-rs
' example), and the Tooltip component is responsible for all the event handling (rather thanOverlay
andOverlayTrigger
).To position the tooltip correctly and mark the target element with accessibility attributes, you need to expose a
NodeRef
for each component you want to add a tooltip to. I've exposedNodeRef
s forButton
,FormControl
andLink
.Unlike regular Bootstrap, this doesn't support tooltips from
data
attributes.I've added examples using all of those controls, and also a direct
ref=
attribute on a HTML elements.