Associates tooltips with HTML elements or selectors.
You can get the TooltipManager
via atom.tooltips
.
The essence of displaying a tooltip
# display it
disposable = atom.tooltips.add(div, {title: 'This is a tooltip'})
# remove it
disposable.dispose()
In practice there are usually multiple tooltips. So we add them to a CompositeDisposable
[CompositeDisposable](../CompositeDisposable/) = require 'atom'
subscriptions = new CompositeDisposable
div1 = document.createElement('div')
div2 = document.createElement('div')
subscriptions.add atom.tooltips.add(div1, {title: 'This is a tooltip'})
subscriptions.add atom.tooltips.add(div2, {title: 'Another tooltip'})
# remove them all
subscriptions.dispose()
You can display a key binding in the tooltip as well with the
keyBindingCommand
option.
disposable = atom.tooltips.add @caseOptionButton,
title: "Match Case"
keyBindingCommand: 'find-and-replace:toggle-case-option'
keyBindingTarget: @findEditor.element
Add a tooltip to the given element.
Argument | Description | ||||
---|---|---|---|---|---|
|
An |
||||
|
See http://getbootstrap.com/javascript/#tooltips-options for a full list of options. You can also supply the following additional options: |
||||
|
A String or Function to use for the text in the tip. If given a function, |
||||
|
|
||||
|
A String containing a command name. If you specify this option and a key binding exists that matches the command, it will be appended to the title or rendered alone if no title is specified. |
||||
|
An |
Return values |
---|
Returns a Disposable on which |