Comments (7)
Hi @ismail-codar, I found a better solution for dynamic and interactive tooltip.
Could you please check https://github.com/tvkhoa/react-tippy for that ? (disabled and html props)
Btw, @atomiks Thanks for your beautiful tooltip project. I port it to React component so that react user can use it conveniently. :)
from tippyjs.
I see, will definitely add this in for the next release, which will probably be v0.4 with the new Popper release which fixed some bugs. Thanks!
from tippyjs.
Do you think it's more appropriate to call this callback wait
, like:
// In library:
const show = () => this.callbacks.wait ? this.callbacks.wait(_show) : _show()
// Usage:
new Tippy(domNode, {
wait(show) {
// Do stuff
setTimeout(() => {
// stuff
show()
}, 0)
}
})
or maybe even manual
, since you want to control the show
of the tooltip... not sure
from tippyjs.
Same idea but yours looks better 👍 I did not send a pull request because I think you should give the code structure.
from tippyjs.
This is included as wait
in v0.4.0 for now (there may be a better solution, but it's there if need be)
from tippyjs.
Hi @tvkhoa The following method is not appropriate for me..
<Tooltip
html={(
<div>Name: {name}</div>
)}
>
<button onClick={changeName}>Change Name</button>
</Tooltip>
Not appropriate because my tooltip content is a large component and available in hundreds of places.
This means this large component renders to html hundreds of times via html={....}. If i use it.
So was my preference is a custom method as mentioned here.
If react-tippy have a working solution similar to following it can be usefull. So tooltip template content must be render on demand.
<div id="my-tooltip-template">Name: {name}</div>
<Tooltip html="my-tooltip-template">
<button onClick={changeName}>Change Name</button>
</Tooltip>
<Tooltip html="my-tooltip-template">
<button onClick={changeName}>Change Name</button>
</Tooltip>
from tippyjs.
Hi @ismail-codar , I miss the notification so sorry for the late response.
You can pass the react element
to html
prop. It's sth like that
const TooltipContent = ({ name }) => (
<div>
<p>Name: {name}</p>
...
</div>
);
...
<Tooltip html={<TooltipContent name={name} />}>
<button onClick={changeName}>Change Name</button>
</Tooltip>
I think your current solution in React is an error-prone. Example: you can not pass the event like onChange
or onClick
to your tooltip content.
from tippyjs.
Related Issues (20)
- Wrong initial animation not working in Angular production mode
- Nested tippies HOT 1
- tippy doesnt load sometimes
- Uncaught TypeError: Cannot read properties of null (reading 'body')
- popups appearing outside viewport on iPad HOT 1
- Is there a reason to reset state.attributes.popper?
- dblclick
- It's undocumented whether tippies should be destroyed when no longer needed
- Issue with Custom SVG Arrow Rendering on Top of Tippy.js Tooltip HOT 1
- Nesting
- Use interactive tooltips in svg context
- Content in Tippy js doesn't react on clicks and another
- ERROR ReferenceError: document is not defined
- Show tippy on selected text of other webpages
- spurious hide() after destroy() related to addDocumentPress() without matching removeDocumentPress()
- data-reference-hidden not working correctly on animation
- Allow `onClickOutside` to conditionally not hide the tippy
- No tooltips are shown (since new were added) HOT 1
- Painless use: Just pull content from the title attribute HOT 2
- Tooltip not working with screen reader
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from tippyjs.