atomiks / tippyjs

Tooltip, popover, dropdown, and menu library
https://atomiks.github.io/tippyjs/
MIT License
11.92k stars 520 forks source link

default tooltip shows at the bottom of content with custom html #935

Closed handhikadj closed 3 years ago

handhikadj commented 3 years ago
image

looking at the image, the default tooltip appears at the bottom and it's ugly. how do I get rid of the default tooltip and leave the custom content behind?

https://codesandbox.io/s/stoic-rubin-qgki5

<div id="this-is-error" class="this-is-error" style="display: none;">
      <div class="row">
        <p style="color: red; font-weight: bold; font-size: 15px;">
          Server error. Unsaved
        </p>
      </div>

      <div class="row mt-5">
        <p id="p-text">This is not showing</p> // this doesn't appear on the tooltip. dunno why
      </div>
    </div>

    <button id="appear-tooltip" type="button" class="btn btn-primary">
      Primary
    </button>

const template = document.getElementById("this-is-error");
      template.style.display = "block";

      tippy("#appear-tooltip", {
        content: template,
        delay: 1000,
        placement: "bottom-end",
        allowHTML: true
      });
atomiks commented 3 years ago

You should style .tippy-box instead of an inner content element. Check the themes docs. Or you can not import the CSS, and style everything from scratch.