Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Tooltip] Add a way for the Tooltip to remain open when the trigger is clicked #1311

Open
sunwrobert opened this issue Jan 9, 2025 · 2 comments
Labels
component: tooltip This is the name of the generic UI component, not the React module! docs Improvements or additions to the documentation status: waiting for maintainer These issues haven't been looked at yet by a maintainer

Comments

@sunwrobert
Copy link

Feature request

This could be useful for something like a copy to clipboard button, where it shows a tooltip with the text Copy, and then after clicking on the button, the text changes to Copied with the tooltip still open. Radix had a way to do this with event.preventDefault()

Summary

Examples in other libraries

Motivation

@github-actions github-actions bot added the status: waiting for maintainer These issues haven't been looked at yet by a maintainer label Jan 9, 2025
@mj12albert mj12albert added the component: tooltip This is the name of the generic UI component, not the React module! label Jan 10, 2025
@oliviertassinari oliviertassinari changed the title [Tooltip] Add a way for the Tooltip to remain open when the trigger is clicked. [Tooltip] Add a way for the Tooltip to remain open when the trigger is clicked Jan 10, 2025
@oliviertassinari
Copy link
Member

oliviertassinari commented Jan 10, 2025

As I understand it, it's possible, developers can control the component: https://base-ui.com/react/components/tooltip#root but it's involves quite a boilerplate.

There's no docs like https://mui.com/material-ui/react-tooltip/#controlled-tooltips to demonstrate it, maybe we should create this.

Radix had a way to do this with event.preventDefault()

Could you share a demo? event.preventDefault() is meant to prevent browser native behavior, this could be an anti-browser pattern.

@oliviertassinari oliviertassinari added the docs Improvements or additions to the documentation label Jan 10, 2025
@github-project-automation github-project-automation bot moved this to Backlog in Base UI Jan 13, 2025
@sunwrobert
Copy link
Author

As I understand it, it's possible, developers can control the component: https://base-ui.com/react/components/tooltip#root but it's involves quite a boilerplate.

There's no docs like https://mui.com/material-ui/react-tooltip/#controlled-tooltips to demonstrate it, maybe we should create this.

Radix had a way to do this with event.preventDefault()

Could you share a demo? event.preventDefault() is meant to prevent browser native behavior, this could be an anti-browser pattern.

radix-ui/primitives#2029 This is how it was done before

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: tooltip This is the name of the generic UI component, not the React module! docs Improvements or additions to the documentation status: waiting for maintainer These issues haven't been looked at yet by a maintainer
Projects
Status: Backlog
Development

No branches or pull requests

4 participants