https://github.com/polymerelements/paper-badge
Material Design status descriptors for elements
https://github.com/polymerelements/paper-badge
Last synced: about 1 year ago
JSON representation
Material Design status descriptors for elements
- Host: GitHub
- URL: https://github.com/polymerelements/paper-badge
- Owner: PolymerElements
- Created: 2015-07-16T20:27:27.000Z (almost 11 years ago)
- Default Branch: master
- Last Pushed: 2023-10-16T14:02:52.000Z (over 2 years ago)
- Last Synced: 2024-10-16T11:03:22.438Z (over 1 year ago)
- Language: HTML
- Homepage: https://www.webcomponents.org/element/PolymerElements/paper-badge
- Size: 448 KB
- Stars: 31
- Watchers: 19
- Forks: 18
- Open Issues: 16
-
Metadata Files:
- Readme: README.md
- Codeowners: .github/CODEOWNERS
Awesome Lists containing this project
README
[](https://www.npmjs.com/package/@polymer/paper-badge)
[](https://travis-ci.org/PolymerElements/paper-badge)
[](https://webcomponents.org/element/@polymer/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](https://www.webcomponents.org/element/@polymer/paper-badge),
[Demo](https://www.webcomponents.org/element/@polymer/paper-badge/demo/demo/index.html).
## Usage
### Installation
```
npm install --save @polymer/paper-badge
```
### In an html file
```html
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';
Inbox
Status
```
### In a Polymer 3 element
```js
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`
Inbox
Status
`;
}
}
customElements.define('sample-element', SampleElement);
```
Example:
```html
Inbox
Status
```
## Contributing
If you want to send a PR to this element, here are
the instructions for running the tests and demo locally:
### Installation
```sh
git clone https://github.com/PolymerElements/paper-badge
cd paper-badge
npm install
npm install -g polymer-cli
```
### Running the demo locally
```sh
polymer serve --npm
open http://127.0.0.1:/demo/
```
### Running the tests
```sh
polymer test --npm
```