[Feature Request] customisable dcc.Tooltip position/direction
Open
Nobody has claimed this yet.
feature
- Dominant language
- Python
- Stars
- 24.4k
- Forks
- 2.3k
- Avg merge
- 2d 7h
- Merged PRs (30d)
- 13
Description
- Add the possibility to combine the existing directions:
direction="bottom+right". dbc.Tooltip already includes this in theirplacementargument: https://dash-bootstrap-components.opensource.faculty.ai/docs/components/tooltip/ - (maybe) add an
offsetargument that allows developers to specify the distance between the hover point and the hover box. Some developers want the box to be further from the data point so that it (the data point) and its context can be seen better. It could look something likedcc.Tooltip(..., offset={"x":"15px", "y":"0px"})
Related requests:
Relevant code:
- https://github.com/plotly/dash/blob/master/components/dash-core-components/src/components/Tooltip.react.js#L44-L98
- Suggestion: make code combine the X and Y values of class
.hover-rightand.hover-bottomin thetransform: translate(X,Y)code
Workaround with css
assets/styles.css
/* makes the hover box go to the bottom right corner */
.hover-content[class^="jsx-"] {
transform: translate(0%,0%) !important;
}
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in components/dash-core-components/src/components/Tooltip.react.js, especially the direction handling around lines 44-98 and the hover-right/hover-bottom transforms. Trace how dcc.Tooltip exposes direction and determine the scope of combining directions and optionally adding offset; done means the requested placement behavior works without relying on the CSS workaround described in the issue.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- css, python, react
- Domain
- data-visualization, frontend
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100