paper-badge

WebJar for paper-badge

License

License

BSD 3-Clause
GroupId

GroupId

org.webjars.bowergithub.polymerelements
ArtifactId

ArtifactId

paper-badge
Last Version

Last Version

3.0.1
Release Date

Release Date

Type

Type

jar
Description

Description

paper-badge
WebJar for paper-badge
Project URL

Project URL

http://webjars.org
Source Code Management

Source Code Management

https://github.com/PolymerElements/paper-badge

Download paper-badge

How to add to project

<!-- https://jarcasting.com/artifacts/org.webjars.bowergithub.polymerelements/paper-badge/ -->
<dependency>
    <groupId>org.webjars.bowergithub.polymerelements</groupId>
    <artifactId>paper-badge</artifactId>
    <version>3.0.1</version>
</dependency>
// https://jarcasting.com/artifacts/org.webjars.bowergithub.polymerelements/paper-badge/
implementation 'org.webjars.bowergithub.polymerelements:paper-badge:3.0.1'
// https://jarcasting.com/artifacts/org.webjars.bowergithub.polymerelements/paper-badge/
implementation ("org.webjars.bowergithub.polymerelements:paper-badge:3.0.1")
'org.webjars.bowergithub.polymerelements:paper-badge:jar:3.0.1'
<dependency org="org.webjars.bowergithub.polymerelements" name="paper-badge" rev="3.0.1">
  <artifact name="paper-badge" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.webjars.bowergithub.polymerelements', module='paper-badge', version='3.0.1')
)
libraryDependencies += "org.webjars.bowergithub.polymerelements" % "paper-badge" % "3.0.1"
[org.webjars.bowergithub.polymerelements/paper-badge "3.0.1"]

Dependencies

There are no dependencies for this project. It is a standalone project that does not depend on any other jars.

Project Modules

There are no modules declared in this project.

Published on NPM Build status Published on webcomponents.org

<paper-badge>

<paper-badge> is a circular text badge that is displayed on the top right corner of an element, representing a status or a notification. It will badge the 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-badge

In an html file

<html>
  <head>
    <script type="module">
      import '@polymer/paper-badge/paper-badge.js';
      import '@polymer/paper-button/paper-button.js';
      import '@polymer/paper-icon-button/paper-icon-button.js';
      import '@polymer/iron-icons/iron-icons.js';
      import '@polymer/iron-icons/social-icons.js';
    </script>
  </head>
  <body>
    <div style="display:inline-block">
      <span>Inbox</span>
      <paper-badge label="3"></paper-badge>
    </div>

    <div>
      <paper-button id="btn">Status</paper-button>
      <paper-badge
          icon="favorite"
          for="btn"
          label="favorite icon">
      </paper-badge>
    </div>

    <div>
      <paper-icon-button
          id="account-box"
          icon="account-box"
          alt="account-box">
      </paper-icon-button>
      <paper-badge
          icon="social:mood"
          for="account-box"
          label="mood icon">
      </paper-badge>
    </div>
  </body>
</html>

In a Polymer 3 element

import {PolymerElement, html} from '@polymer/polymer';
import '@polymer/paper-badge/paper-badge.js';
import '@polymer/paper-button/paper-button.js';
import '@polymer/paper-icon-button/paper-icon-button.js';
import '@polymer/iron-icons/iron-icons.js';
import '@polymer/iron-icons/social-icons.js';

class SampleElement extends PolymerElement {
  static get template() {
    return html`
      <div style="display:inline-block">
        <span>Inbox</span>
        <paper-badge label="3"></paper-badge>
      </div>

      <div>
        <paper-button id="btn">Status</paper-button>
        <paper-badge
            icon="favorite"
            for="btn"
            label="favorite icon">
        </paper-badge>
      </div>

      <div>
        <paper-icon-button
            id="account-box"
            icon="account-box"
            alt="account-box">
        </paper-icon-button>
        <paper-badge
            icon="social:mood"
            for="account-box"
            label="mood icon">
        </paper-badge>
      </div>
    `;
  }
}
customElements.define('sample-element', SampleElement);

Example:

<div style="display:inline-block">
  <span>Inbox</span>
  <paper-badge label="3"></paper-badge>
</div>

<div>
  <paper-button id="btn">Status</paper-button>
  <paper-badge icon="favorite" for="btn" label="favorite icon"></paper-badge>
</div>

<div>
  <paper-icon-button id="account-box" icon="account-box" alt="account-box"></paper-icon-button>
  <paper-badge icon="social:mood" for="account-box" label="mood icon"></paper-badge>
</div>

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-badge
cd paper-badge
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
org.webjars.bowergithub.polymerelements

Versions

Version
3.0.1
2.1.0
2.0.0