@asphalt-react/badge
v2.12.0
Published
Badge
Readme
Badge
A Badge nudges users to notify them of any action that took place or status of an element or feature. It accepts content to show a value, for example number of notifications, or text like "new" or "coming soon". You can choose to display text content in uppercase. Badges have different intents and defaults to "neutral". There are two types of badges:
- Badge
- Ribbon
Set the tailRight prop on the Ribbon Badge to control tail placement. The tail appears on the right when set, and defaults to the left when not set.
Usage
import { Badge, Ribbon } from "@asphalt-react/badge"
<Badge />
<Badge>25</Badge>
<Ribbon>New</Ribbon>Intents
Badge supports 7 intents:
- neutral (default): demands less user attention
- brand: brand related nudges
- danger: denotes an element of risk like deletion
- success: nudges to denote successful actions
- info: an informative nudge
- warning: demands more attention than info
- muted: indicates the inactive
Sizes
- Sizes apply only to the Ribbon. It supports 5 sizes: extra small (xs), small (s), medium (m) (Default), and large (l).
Props
children
Content for Badge.
| type | required | default | | ---- | -------- | ------- | | node | false | null |
neutral
Applies neutral intent.
| type | required | default | | ---- | -------- | ------- | | bool | false | false |
brand
Applies brand intent.
| type | required | default | | ---- | -------- | ------- | | bool | false | false |
danger
Applies danger intent.
| type | required | default | | ---- | -------- | ------- | | bool | false | false |
warning
Applies warning intent.
| type | required | default | | ---- | -------- | ------- | | bool | false | false |
info
Applies info intent.
| type | required | default | | ---- | -------- | ------- | | bool | false | false |
success
Applies success intent.
| type | required | default | | ---- | -------- | ------- | | bool | false | false |
muted
Applies muted intent.
| type | required | default | | ---- | -------- | ------- | | bool | false | false |
uppercase
Transforms the text to uppercase.
| type | required | default | | ---- | -------- | ------- | | bool | false | false |
Ribbon
Props
children
Content for Ribbon.
| type | required | default | | ---- | -------- | ------- | | node | false | null |
neutral
Applies neutral intent.
| type | required | default | | ---- | -------- | ------- | | bool | false | false |
brand
Applies brand intent.
| type | required | default | | ---- | -------- | ------- | | bool | false | false |
danger
Applies danger intent.
| type | required | default | | ---- | -------- | ------- | | bool | false | false |
warning
Applies warning intent.
| type | required | default | | ---- | -------- | ------- | | bool | false | false |
info
Applies info intent.
| type | required | default | | ---- | -------- | ------- | | bool | false | false |
success
Applies success intent.
| type | required | default | | ---- | -------- | ------- | | bool | false | false |
muted
Applies muted intent.
| type | required | default | | ---- | -------- | ------- | | bool | false | false |
uppercase
Transforms the text to uppercase.
| type | required | default | | ---- | -------- | ------- | | bool | false | false |
tailRight
Enables tail on right side.
| type | required | default | | ---- | -------- | ------- | | bool | false | false |
size
Size of the Ribbon.
| type | required | default | | ---- | -------- | ------- | | enum | false | "m" |
