I am working on Tooltip, where my requirement is to show more details line by line inside tooltip, when user hovers over some iconbutton. Currently, I am trying like this:
{kind: "moon.TooltipDecorator", components: [
{kind: "moon.IconButton", src: "$lib/moonstone/samples/assets/icon-button-enyo-logo.png"},
{kind: "moon.Tooltip", name:'info', floating: true, contentUpperCase: false,allowHtml: true, content: "Floating tooltip <br>for an IconButton."}
]
}
But this is treating HTML content just like strings. I tried to set dynamically, but result is same. Below what i tried:
this.$.info.setContent('Fare Charges'+ "<span style='border:1px solid'"+flightsData[0].price+'</span><br>'+'<span>Some more data</span>');
Is there any ways to achieve it?
moon.Tooltip was designed to only be a single line of text. If you want more than one line, you can create your own tooltip based off of moon.Tooltip.
enyo.kind({
name: 'my.Tooltip',
kind: 'moon.Tooltip',
published: {
allowHtml: false
},
allowHtmlChanged: function() {
this.$.client.set('allowHtml', this.allowHtml);
},
create: function () {
this.inherited(arguments);
this.allowHtmlChanged();
},
});
enyo.kind({
name: "App",
components: [
{kind: "moon.TooltipDecorator", components: [
{kind: "moon.IconButton", src: "$lib/moonstone/samples/assets/icon-button-enyo-logo.png"},
{kind: "my.Tooltip", name:'info', floating: true, contentUpperCase: false, allowHtml: true, content: "Floating tooltip <br>for an IconButton."}
]
}
]
});
new App().renderInto(document.body);
You also need to override the .moon-tooltip-label CSS class:
.moon-tooltip-label {
height:auto;
}