The New Way to Build with AI! Introducing ReUI — the developer platform for agentic UI with shadcn/ui
Browse ReUI Pro

Vue Metronic 8 - Tooltip HTML

Hi,

I am trying to get the datatable cells to have a tooltip and it part works:

<pre> <template v-slot:taster="{ row: item }"> <div v-html="getMoreInfo(item.Id, `name`)" data-toggle="tooltip" data-placement="top" data-html="true" :title="getTasterInfo(item.Id, `tooltip`)" ></div> </template> </pre>

2 problems

  1. "data-html="true" doesnt do anything and if I try to add HTML into the tooltip, it just renders the raw HTML tags (I tried also data-bs-html etc )
  2. Defining .tooltip style on the page doesnt apply - I cannot seem to be able to override the style locally.

I did notice that on the Calendar app, since the tooltip is generated by the <script> section, both HTML and .tooltip works. But I just dont see a any event for the datatable that I can attach to which would give me the ability to create a tooltip for each cell.

Text formatting options
Submit
Click any option to insert into your comment. Select text first to wrap it.
  • **text** to make things bold
  • *text* to emphasize
  • ### Heading to make headings
  • [link text](url) for links
  • ![alt text](image-url) to paste in an image
  • - item to make a list
  • 1. item to make an ordered list
  • > quote to quote somebody
  • `code` for single line of code
  • ```js ... ``` for JS code block
  • ```html ... ``` for HTML code block
  • ```scss ... ``` for SCSS code block
  • ```php ... ``` for PHP code block
  • --- for a horizontal rule
  • happy  :)
  • shocked  :|
  • sad  :(

Replies (4)


Example style I defined on the page to no effect:

.tooltip {
position: absolute;
z-index: 9999;
background: #ffc107;
color: black;
width: 150px;
border-radius: 3px;
box-shadow: 0 0 2px;
}


Other example I took from getbootstrap.com and have the same issues I mentioned:

<button
type="button"
class="btn btn-secondary"
data-bs-toggle="tooltip"
data-bs-html="true"
data-bs-title="<em>Tooltip</em> <u>with</u> <b>HTML</b>"
>
Tooltip with HTML
</button>



Hi Chris,

You can add tooltips using our v-tooltipdirective.

<button
type="button"
class="btn btn-secondary"
v-tooltip
data-bs-html="true"
data-bs-title="<em>Tooltip</em> <u>with</u> <b>HTML</b>"
>
Tooltip with HTML
</button>


Regards,
Lauris Stepanovs,
Keenthemes Support Team


Hi Lauris,

v-tooltip did not resolve the issues I mentioned. Instead I get:

[Vue warn]: Failed to resolve directive: tooltip

As I said, data-bs-toggle="tooltip" works, but I cannot style it and I cannot add HTML inside the title property.

Here is what I got (same thing happens outside of datatable):

<pre> <Datatable @on-sort="sort" @on-items-select="onItemSelect" :data="tableData" :header="tableHeader" :enable-items-per-page-dropdown="true" :checkbox-enabled="true" checkbox-label="id" :loading="loading" > <template v-slot:taster="{ row: item }"> <div v-html="getMoreInfo(item.cognitoUserId, `name`)" data-bs-toggle="tooltip" data-bs-placement="top" data-bs-html="true" :title="getMoreInfo(item.cognitoUserId, `tooltip`)" ></div> </template> </pre>

Hi Chris,

Which Metronic version are you using?

We have added a tooltip directive in the latest Metronic v8.1.6 release.

If you are using older versions then you can register this directive in file src/main.ts.


app.directive("tooltip", (el) => {
new Tooltip(el);
});


Regards,
Lauris Stepanovs,
Keenthemes Support Team


Text formatting options
Submit
Click any option to insert into your comment. Select text first to wrap it.
  • **text** to make things bold
  • *text* to emphasize
  • ### Heading to make headings
  • [link text](url) for links
  • ![alt text](image-url) to paste in an image
  • - item to make a list
  • 1. item to make an ordered list
  • > quote to quote somebody
  • `code` for single line of code
  • ```js ... ``` for JS code block
  • ```html ... ``` for HTML code block
  • ```scss ... ``` for SCSS code block
  • ```php ... ``` for PHP code block
  • --- for a horizontal rule
  • happy  :)
  • shocked  :|
  • sad  :(
Text formatting options
Submit
Click any option to insert into your comment. Select text first to wrap it.
  • **text** to make things bold
  • *text* to emphasize
  • ### Heading to make headings
  • [link text](url) for links
  • ![alt text](image-url) to paste in an image
  • - item to make a list
  • 1. item to make an ordered list
  • > quote to quote somebody
  • `code` for single line of code
  • ```js ... ``` for JS code block
  • ```html ... ``` for HTML code block
  • ```scss ... ``` for SCSS code block
  • ```php ... ``` for PHP code block
  • --- for a horizontal rule
  • happy  :)
  • shocked  :|
  • sad  :(
buy metronic keenthemes mega bundle

ReUI

Open-source React components, blocks and templates built on shadcn/ui and Tailwind CSS by Keenthemes.