Badge
a small graphical element or indicator that is typically displayed on top of another element, such as an icon, text, or button, to provide additional information or visual cues to the user. Badges are commonly used to highlight status, notifications, counts, labels, or categories.
Usage
Code EditorCopyimport { Badge } from '@erudilabs/alma'
Types
Code EditorCopyimport type { BadgeThemeProps, BadgeSizeProps, BadgeShapeProps } from '@erudilabs/alma'
BadgeShapeProps = 'circle' | 'square'
BadgeThemeProps = 'default' | 'primary' | 'danger' | 'success' | 'warning'
BadgeSizeProps = 'small' | 'medium' | 'large'
Component
Here preview and detail explain of Avatar
component
Default
Code EditorCopy<Badge>Default</Badge>
Theme
These themes allow you to apply different visual styles to the badge
, Whether it's indicating different statuses, categories, or providing visual cues, the ability to customize badge themes adds flexibility and enhances the visual appeal of your UI components.
Primary
Code EditorCopy<Badge theme="primary">Primary</Badge>
Danger
Code EditorCopy<Badge theme="danger">Danger</Badge>
Warning
Code EditorCopy<Badge theme="warning">Warning</Badge>
Success
Code EditorCopy<Badge theme="success">Success</Badge>
Size
Prop determines the dimensions of the badge
, affecting its width
, height
, and padding
. You can define different sizes
Small
Code EditorCopy<Badge theme="primary" size="small">Small</Badge>
Medium
Code EditorCopy<Badge theme="primary" size="medium">Medium</Badge>
Large
Code EditorCopy<Badge theme="primary" size="large">Large</Badge>
Shape
Prop allows you to specify the shape
of the badge. It can be set as circle
for a circular badge or rounded
for a badge with rounded corners.
Circle
Code EditorCopy<Badge theme="warning" shape="circle">Circle</Badge>
Square
Code EditorCopy<Badge theme="warning" shape="square">Square</Badge>
Props Reference
Prop
Type
Default
id?
string
-
testId?
string
-
className?
string
-
children
ReactNode
-
theme?
BadgeThemeProps
default
size?
BadgeSizeProps
medium
shape?
BadgeShapeProps
circle