Skip to content
This repository has been archived by the owner on Dec 19, 2024. It is now read-only.

PolymerElements/paper-tooltip

This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Folders and files

NameName
Last commit message
Last commit date

Latest commit

1a4a78e · Jan 4, 2019
Aug 23, 2018
Aug 8, 2018
Jan 4, 2019
Aug 16, 2018
Aug 16, 2018
Sep 7, 2018
May 17, 2016
Jul 17, 2018
Sep 14, 2018
Aug 8, 2018
Jun 23, 2018
Sep 14, 2018
Sep 14, 2018
Jan 4, 2019
Jun 5, 2018

Repository files navigation

Published on NPM Build status Published on webcomponents.org

<paper-tooltip>

<paper-tooltip> is a label that appears on hover and focus when the user hovers over an element with the cursor or with the keyboard. It will be centered to an anchor element specified in the for attribute, or, if that doesn't exist, centered to the parent node containing it.

See: Documentation, Demo.

Usage

Installation

npm install --save @polymer/paper-tooltip

In an html file

<html>
  <head>
    <script type="module">
      import '@polymer/paper-tooltip/paper-tooltip.js';
    </script>
  </head>
  <body>
    <div style="display:inline-block">
      <button>Click me!</button>
      <paper-tooltip>Tooltip text</paper-tooltip>
    </div>

    <div>
      <button id="btn">Click me!</button>
      <paper-tooltip for="btn">Tooltip text</paper-tooltip>
    </div>
  </body>
</html>

In a Polymer 3 element

import {PolymerElement, html} from '@polymer/polymer';
import '@polymer/paper-tooltip/paper-tooltip.js';

class SampleElement extends PolymerElement {
  static get template() {
    return html`
      <div style="display:inline-block">
        <button>Click me!</button>
        <paper-tooltip>Tooltip text</paper-tooltip>
      </div>

      <div>
        <button id="btn">Click me!</button>
        <paper-tooltip for="btn">Tooltip text</paper-tooltip>
      </div>
    `;
  }
}
customElements.define('sample-element', SampleElement);

Contributing

If you want to send a PR to this element, here are the instructions for running the tests and demo locally:

Installation

git clone https://github.com/PolymerElements/paper-tooltip
cd paper-tooltip
npm install
npm install -g polymer-cli

Running the demo locally

polymer serve --npm
open http://127.0.0.1:<port>/demo/

Running the tests

polymer test --npm