Badge
Badge generates a small badge, which can be used to show notification with count or just a dot.
Basic Badge
Example of a badge containing text.
Preview
Usage
import { Badge } from 'archi-ui'
<Badge badgeContent='new' />
Variants
The Badge
comes with a two variants: standard(default) and dot.
You can use standard
variant for displaying count or some content like text, icons, an SVG icon.
The dot
prop changes a badge into a small dot. This can be used as a notification that something has changed without using a count.
Preview
Color
Use color
prop to apply different colors to component.
Preview
Size
Use size
prop to change the size of the badge.
Preview
Badge Visibility
The visibility of badges can be controlled using the invisible
prop.
Preview
Show Badge
showZero Prop
The badge hides automatically when badgeContent
is zero. You can override this with the showZero
prop.
Preview
Maximum Value
You can use the max
prop to cap the value of the badge content.
Preview
Badge Alignment
Preview
Badge API
API reference docs for the React Badge component.
Props
Name | Type | Default | Description |
---|---|---|---|
badgeContent | node | - | The content rendered within the badge. |
className | string | - | Override or extend the styles applied to the component. |
variant | 'standard' | 'dot' | 'standard' | The variant to use. |
size | 'sm' | 'md' | 'lg' | 'sm' | The size of the badge. |
rounded | 'none' | 'full' | 'md' | 'full' | The border-radius of the component. |
color | 'default' | 'primary' | 'secondary' | 'info' | 'warning' | 'success' | 'error' | 'primary' | The color of the component. |
invisible | bool | false | If true , the badge is invisible. |
showZero | bool | false | Controls wheather the badge is hidden when badgeContent is zero. |
max | number | 99 | Max count to show. |