-
-
Notifications
You must be signed in to change notification settings - Fork 78.9k
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
Add CSS class for tooltip HTML mode #38874
Comments
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
Hello @HybridSolutions ! <button type="button" class="btn btn-secondary"
data-bs-toggle="tooltip" data-bs-placement="top"
data-bs-html="true"
data-bs-custom-class="html-tooltip"
data-bs-title="<em>Tooltip</em> <u>with</u> <b>HTML</b>">
Tooltip with HTML
</button> .html-tooltip {
--bs-tooltip-max-width: 400px;
} |
This comment was marked as spam.
This comment was marked as spam.
I'm aware of the alternative. I only made the suggestion because the class Cheers ;) |
Find the css code
This code adds a new CSS class called bs-tooltip-html that removes the max-width limit from tooltips. It also adds a new option to the tooltip initialization that checks for the data-html attribute and sets the template option accordingly, adding the bs-tooltip-html class to the tooltip element. With this code, you can now use the data-html="true" attribute on your tooltips to enable HTML content and extend the max-width if needed. |
Thanks for the effort. I know all these workarounds but the issue I was pointing was not how to find a way of changing the CSS of an html tooltip, but a design issue. BS is assigning other classes according to attributes so it would make sense to also have the class i mentioned assigned as well. Both the custom class or this workaround works but the core design is not correct. Html tooltips should not have max-width set to a fixed value by default. It should have the |
I don't mind adding a |
It's not just that. Max-width should be set to “fit-content” when |
Prerequisites
Proposal
It would be interesting to have BS add a CSS class like bs-tooltip-html to the tooltip whenever the html attribute is set to true.
Motivation and context
By default, tooltips have a max-width, but in some cases, when using HTML inside tooltips, it's required to extend the max-width. Yes it's possible to add a custom class but a standard class would be nice.
The text was updated successfully, but these errors were encountered: