Badge
Badges are visual indicators for numeric values such as tallies and scores. They're commonly used before and after the label of the thing they're quantifying.
They must be used singly after a single item name, and have only numbers.
- Use lozenges for statuses.
- Use labels to call out tags and high-visibility attributes.
- Use a tooltip if you want to indicate units.
Try it out
Interact with a live demo of the ak-badge component.
Installation
npm install ak-badge
Using the component
HTML
The ak-badge
package exports the AkBadge Skate component.
Import the component in your JS resource as follows:
bundle.js
import AkBadge from 'ak-badge';
Now we can use the defined tag in our HTML markup:
index.html
<html>
<head>
<script src="bundle.js"></script>
</head>
<body>
<ak-badge value="256" appearance="added"></ak-badge>
</body>
React
This is a standard web component, if you want to use it in your React app, use the Skate.js React integration.
import AkBadge from 'ak-badge';
import reactify from 'skatejs-react-integration';
const ReactComponent = reactify(AkBadge, {});
ReactDOM.render(<ReactComponent />, container);
AkBadge
Kind: global class
new AkBadge()
Create instances of the component programmatically, or using markup.
JS Example
import AkBadge from 'ak-badge';
const component = new AkBadge();
akBadge.value : number
The value displayed within the badge.
Kind: instance property of AkBadge
Default: 0
akBadge.max : number
The max value to display.
If value is 100, and max is 50, "50+" will be displayed
Kind: instance property of AkBadge
Default: 99
akBadge.appearance : string
Affects the visual style of the badge.
Allowed values are: 'default', 'primary', 'important', 'added', 'removed'.
Kind: instance property of AkBadge
Default: "default"
Support and feedback
We're here to help!
Let us know what you think of our components and docs, your feedback is really important for us.
Ask a question in our forum.
Check if someone has already asked the same question before.
Create a support ticket
Are you in trouble? Let us know!