Badges
Badge components are used to display notifications, counts, labels, and status indicators in your application.ChromiaBadge
A customizable badge component for displaying notifications and indicators on other widgets.Basic Usage
Parameters
The widget to display the badge on.
The value to display in the badge. If null or empty, displays a dot badge.
Whether to show the badge.
Position of the badge relative to the child. Default is top right.
Background color of the badge.
Text color of the badge.
Size of the badge. Options:
small (16px), medium (18px), large (20px).Shape of the badge. Options:
circle, rounded, square.Maximum value to display. Values above this show as “99+”.
Examples
Notification Badge
Dot Badge
Custom Position
Custom Colors
High Count Badge
Conditional Badge
ChromiaBadgePosition
Factory methods for positioning badges:ChromiaBadgePosition.topRight({double? offset})- Top right corner (default)ChromiaBadgePosition.topLeft({double? offset})- Top left cornerChromiaBadgePosition.bottomRight({double? offset})- Bottom right cornerChromiaBadgePosition.bottomLeft({double? offset})- Bottom left corner
ChromiaLabel
A standalone badge that can be used inline as a label or tag.Parameters
Text to display in the label.
Background color of the label.
Text color of the label.
Optional icon to display before the text.
Callback when the remove button is pressed. If provided, displays a close icon.
Custom border radius for the label.
Examples
Simple Label
Label with Icon
Removable Label (Tag)
Custom Styled Label
ChromiaStatusBadge
A status badge for showing status indicators with optional text.Parameters
Status type. Options:
success, warning, error, info, neutral.Optional status text to display next to the status dot.
Whether to show the status dot.
Examples
Status Dot Only
Status with Text
Warning Status
Error Status
Info Status
Text Only (No Dot)
Enums
ChromiaBadgeSize
small- 16px heightmedium- 18px height (default)large- 20px height
ChromiaBadgeShape
circle- Circular badgerounded- Rounded rectangle badgesquare- Square badge with slight rounding
ChromiaStatusType
success- Green indicatorwarning- Yellow indicatorerror- Red indicatorinfo- Blue indicatorneutral- Gray indicator
