Flutter docs
Default skin

Badge

Small numerical value or status descriptor for UI elements.

When to use

Badge normally appears in proximity to notifications or user avatars with eye-catching appeal, typically displaying unread messages count.

Examples

Basic

Simplest Usage. Badge will be hidden when count is 0, but we can use showZero to show it.

Overflow Count

${overflowCount}+ is displayed when count is larger than overflowCount. The default value of overflowCount is 99.

Dynamic

The count will be animated as it changes.

Offset

Set offset of the badge dot, the format is [left, top], which represents the offset of the status dot from the left and top of the default position.

Status

Standalone badge with status.

Ribbon

Use ribbon badge.

Standalone

Used in standalone when children is empty.

Red badge

This will simply display a red badge, without a specific count. If count equals 0, it won't display the dot.

Clickable

The badge can be wrapped with a tag to make it linkable.

Size

Set size of numeral Badge.

Colorful Badge

We preset a series of colorful Badge styles for use in different situations. You can also set it to a hex color string for custom color.

Custom semantic dom styling

You can customize the semantic dom style of Badge by passing objects/functions through classNames and styles.

API

Badge and Badge.Ribbon are exported from @ceebee/ui/client.

Badge

PropertyDescriptionTypeDefaultVersion
colorCustomize Badge dot colorstring-—
countNumber to show in badgeReactNode-—
classNamesCustomize class for each semantic structure inside the component. Supports object or function.Record<SemanticDOM, string> | (info: { props })=> Record<SemanticDOM, string>-—
dotWhether to display a red dot instead of countbooleanfalse—
offsetSet offset of the badge dot\[number, number]-—
overflowCountMax count to shownumber99—
showZeroWhether to show badge when count is zerobooleanfalse—
sizeIf count is set, size sets the size of badgemedium | small--
statusSet Badge as a status dotsuccess | processing | default | error | warning-—
stylesCustomize inline style for each semantic structure inside the component. Supports object or function.Record<SemanticDOM, CSSProperties> | (info: { props })=> Record<SemanticDOM, CSSProperties>-—
textIf status is set, text sets the display text of the status dotReactNode-—
titleText to show when hovering over the badge. Set to null or false to remove the native tooltipstring | null | false-6.5.0

Badge.Ribbon

PropertyDescriptionTypeDefaultVersion
classNamesCustomize class for each semantic structure inside the component. Supports object or function.Record<SemanticDOM, string> | (info: { props })=> Record<SemanticDOM, string>-—
colorCustomize Ribbon colorstring-—
placementThe placement of the Ribbon, start and end follow text direction (RTL or LTR)start | endend—
stylesCustomize inline style for each semantic structure inside the component. Supports object or function.Record<SemanticDOM, CSSProperties> | (info: { props })=> Record<SemanticDOM, CSSProperties>-—
textContent inside the RibbonReactNode-—