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
Changing popover background color on tooltip #467
Comments
Try this: <b-tooltip :content="name" :popover-style="{background: '#ffffff'}" placement="bottom">
<img ref="image" class="img-fluid" :src="src">
</b-tooltip> Be sure to include Remember that it takes an object, not a string, so your values (if not a number) should be enclosed in quotes, and this if a style name has a |
Updated my own copy and while the tooltip works perfectly still the background still won't change here's what I tried to be sure,
Here's a gif of the popover I'm trying to change in case I've not used the correct terminology, The black background on the tooltip is what I'm trying to change which I gathered from the documentation was the popover-style. |
I have also tried targeting the tooltip via css but to no avail using the below;
I'm presuming that because the tooltip is generated outside of the app itself it either can't see this styling or It needs to be applied after the tooltip has been generated. |
Tooltips are handled by the external library I've tried the following: https://jsfiddle.net/43u0rtth/, which uses CSS to change the BG color to blue: .tooltip-inner {
background-color: #44f;
} It appears that the prop The template used by tooltip is a bit differnt than popover: <template>
<div>
<span ref="trigger"><slot></slot></span>
<div tabindex="-1" :class="['tooltip','tooltip-' + this.placement]"
ref="popover" @focus="$emit('focus')" @blur="$emit('blur')"
:style="{opacity:showState?1:0}"
>
<div class="tooltip-inner">
<slot name="content"><span v-html="content || title"></span></slot>
</div>
</div>
</div>
</template> And doesn't use the |
I think we should update the tooltip to be like this, so that Although this wont change the color of the tooltip's arrow :( |
Defining these styles outside the component itself does seem cumbersome and negates the fact we have scoped css blocks, Using your example I added the styles outside of the #app css block like below. Which has solved my issue. Note you'll need to use
Perhaps being able to give a background-color and arrow color would be beneficial properties, though a single style property that could also do the text and other parts might be more favorable. |
The arrow is done by a pseudo element So it wouldn't be something that can be inherited from the |
Maybe having the ability to add a class to the |
Currently tooltip inherits all code from popover, but doesn't use it all. I propose that we move the common parts out into a mixin, and then make the parts that are not common to both as local props/data in the components. This might help reduce the bit of confusion as to the extra not-used props on tooltip. Also note that Bootstrap V4 is moving away from |
@tmorehouse I agree with the mixins as having something on the component would make this as easy as it should be. Furthermore thanks for the insight into the oncoming changes! You've been most helpful. |
One option to get around this for now would be to add a class to HTML: <b-tooltip class="blue-tip" content="Online!" show>
<b-btn variant="outline-success">Live chat</b-btn>
</b-tooltip> CSS: /* tooltip background color */
.blue-tip .tooltip-inner {
background-color: #44f !important;
color: #fff !important;
}
/* arrrow color */
.blue-tip .tooltip-inner::before {
border-top-color: #44f !important;
} The |
@tmorehouse would you accept a PR with a new revamped tooltip that would accept a color prop and even a component so that users could supply their own tooltip? |
Note that tooltips (and popovers) are being changed substantially with the release of Bootstrap V4.beta.1, and the replacement of tether with popper.js. The new tooltips will provide greater control and customization. So you may want to wait until the newest Bootstrap V4 is released. |
Ok awesome 👍 |
This appears to still be an issue even after the release of Bootstrap V4. Now that Popper.js is being used, and specifically Tooltip.js for the tooltips, none of the previous workarounds are working for me anymore. Can we please reopen this issue? |
It seems <b-tooltip :popover-style="{textAlign:'left', whatever:other, css... }" does not work. There is no mention of it in the popover-style in documentation either here: https://bootstrap-vue.org/docs/components/tooltip/ Am I missing a step? |
I'm currently trying to figure out how to use the popover-style object correctly and the documentation doesn't really provide what I'm supposed to be passing to change styling. From the popover component I have gathered it finds a style:
So I have tried adding the
popover-style
attribute with an object containing a background property as below:I'm not really sure how I'm supposed to be changing the background of this popover really at all as the documentation isn't clear of what it is expecting and can do.
The text was updated successfully, but these errors were encountered: