Badge

Badges are used to display small numeric values or status descriptors for UI elements.

2

Installation

If @melio-ui/react is already installed globally, you can skip this step.

Import

  • BadgeRoot: All parts of the badge are included.
  • BadgeContent: Elements that display a small numeric value or status description.

Another way to import

'use client';
import { Badge } from '@melio-ui/badge';
<Badge.Root>
<Badge.Content />
</Badge.Root>;

'use client' must be used when rendering on the server side.

API Reference

BadgeRoot

All parts of the badge are included.

PropTypeDefaultDescription
maxnumber-Up to the set maximum value is displayed, and values beyond that are shown with a +.
placementTypeAttributes.Placement

"top" | "top-left" | "top-right" | "bottom" | "bottom-left" | "bottom-right"
"top-right"Specifies the location of the value.

BadgeContent

Elements that display a small numeric value or status description.

PropTypeDefaultDescription
childrenstring | number-The value of the badge.

Examples

Setting the maximum value

<BadgeRoot max={99}>
<BadgeContent>{1000}</BadgeContent>
<UserIcon width="2em" height="2em" />
</BadgeRoot>

Placement

<BadgeRoot placement="bottom-right">
<BadgeContent>{10}</BadgeContent>
<UserIcon width="2em" height="2em" />
</BadgeRoot>

Only value

<BadgeRoot>
<BadgeContent>{10}</BadgeContent>
</BadgeRoot>
DocsMelioUI
Copyright © Ahn Co. All rights reserved.