1

I have a lightning component button in a custom lightning component. I want a hover text to appear on the button. Is this possible in lightning?

3
  • 1
    The title attribute allows you to define the text that "Displays tooltip text when the mouse moves over the element". Do you want something fancier than that?
    – Keith C
    Commented Jun 27, 2018 at 8:09
  • Actually I want it to be displayed in red. I don't think i can do that with title attribute
    – Madhurima
    Commented Jun 27, 2018 at 8:16
  • Agreed it can't.
    – Keith C
    Commented Jun 27, 2018 at 9:01

2 Answers 2

1

You can try to add you text with transparency and remove opacity on hover.

.my-button-text { opacity: 0; } .my-button-text:hover { opacity: 1.0; }

Hope it can help resolve you problem.

0

Here are two options.

You can specify the title attribute of the lightning:icon element.

<lightning:icon iconName="utility:info" alternativeText="More Information" title="Help text goes here." />

The alternative-text attribute is what's read as assistive text followed by the help text.

Here's how it looks.

Or, you can use the helptext component instead of the icon component. It's the icon with the help text on hover. You can only use the utility icons with this though, but there are over 200. The icon is specified the same way, and the content attribute specifies the text shown on hover.

<lightning:helptext iconName="utility:info" size="xx-small" content = 'Help text goes here. ' alternative-text = 'More Information'/>

Here's a link to the documentation.

I hope this helps.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .