logoAnt Design

⌘ K
  • Design
  • Development
  • Components
  • Blog
  • Resources
YouMindTRACTIANLobeHubCodeRabbit
6.4.5
  • Components Overview
  • Changelog
    v6.4.5
  • General
    • Button
    • FloatButton
    • Icon
    • Typography
  • Layout
    • Divider
    • Flex
    • Grid
    • Layout
    • Masonry
      6.0.0
    • Space
    • Splitter
  • Navigation
    • Anchor
    • Breadcrumb
    • Dropdown
    • Menu
    • Pagination
    • Steps
    • Tabs
  • Data Entry
    • AutoComplete
    • Cascader
    • Checkbox
    • ColorPicker
    • DatePicker
    • Form
    • Input
    • InputNumber
    • Mentions
    • Radio
    • Rate
    • Select
    • Slider
    • Switch
    • TimePicker
    • Transfer
    • TreeSelect
    • Upload
  • Data Display
    • Avatar
    • Badge
    • Calendar
    • Card
    • Carousel
    • Collapse
    • Descriptions
    • Empty
    • Image
    • List
      DEPRECATED
    • Popover
    • QRCode
    • Segmented
    • Statistic
    • Table
    • Tag
    • Timeline
    • Tooltip
    • Tour
    • Tree
  • Feedback
    • Alert
    • Drawer
    • Message
    • Modal
    • Notification
    • Popconfirm
    • Progress
    • Result
    • Skeleton
    • Spin
    • Watermark
  • Other
    • Affix
    • App
    • BorderBeam
      6.4.0
    • ConfigProvider
    • Util
When To Use
Examples
Basic
Standalone
Overflow Count
Red badge
Dynamic
Clickable
Offset
Size
Status
Colorful Badge
Ribbon
Custom semantic dom styling
API
Badge
Badge.Ribbon
Semantic DOM
Badge
Badge.Ribbon
Design Token

Badge

Small numerical value or status descriptor for UI elements.
Importimport { Badge } from 'antd';
GitHub
components/badgeIssueOpen issues
Docs
Edit this pageLLMs.md
AvatarCalendar

Resources

Ant Design X
Ant Design Charts
Ant Design Pro
Pro Components
Ant Design Mobile
Ant Design Mini
Ant Design Web3
Ant Design Landing-Landing Templates
Scaffolds-Scaffold Market
Umi-React Application Framework
dumi-Component doc generator
qiankun-Micro-Frontends Framework
Ant Motion-Motion Solution
China Mirror 🇨🇳

Community

Awesome Ant Design
Medium
X
yuque logoAnt Design in YuQue
Ant Design in Zhihu
Experience Cloud Blog
seeconf logoSEE Conf-Experience Tech Conference

Help

GitHub
Change Log
FAQ
For Agents
Bug Report
Issues
Discussions
StackOverflow
SegmentFault

Ant XTech logoMore Products

yuque logoYuQue-Document Collaboration Platform
AntV logoAntV-Data Visualization
Egg logoEgg-Enterprise Node.js Framework
Kitchen logoKitchen-Sketch Toolkit
Galacean logoGalacean-Interactive Graphics Solution
WeaveFox logoWeaveFox-AI Development with WeaveFox 🦊
xtech logoAnt Financial Experience Tech
Theme Editor
Made with ❤ by
Ant Group and Ant Design Community
loading

When To Use

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

Examples

API

Common props ref:Common props

Badge

PropertyDescriptionTypeDefaultVersionGlobal Config
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>-5.7.0
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>-5.7.0
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

PropertyDescriptionTypeDefaultVersionGlobal Config
classNamesCustomize class for each semantic structure inside the component. Supports object or function.Record<SemanticDOM, string> | (info: { props })=> Record<SemanticDOM, string>-6.0.0
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>-6.0.0
textContent inside the RibbonReactNode-×

Semantic DOM

Badge

Badge.Ribbon

Design Token

Component TokenHow to use?
Token NameDescriptionTypeDefault Value
dotSizeSize of dot badgenumber6
indicatorHeightHeight of badgestring | number20
indicatorHeightSMHeight of small badgestring | number14
indicatorZIndexz-index of badgestring | numberauto
paddingInlineInline padding of multiple words badgestring | number8
statusSizeSize of status badgenumber6
textFontSizeFont size of badge textnumber12
textFontSizeSMFont size of small badge textnumber12
textFontWeightFont weight of badge textstring | numbernormal
Global TokenHow to use?
Token NameDescriptionTypeDefault Value
colorBorderBgControl the color of background border of element.string#ffffff
colorErrorUsed to represent the visual elements of the operation failure, such as the error Button, error Result component, etc.string#ff4d4f
colorErrorHoverThe hover state of the error color.string#ff7875
colorInfoUsed to represent the operation information of the Token sequence, such as Alert, Tag, Progress, and other components use these map tokens.string#1677ff
colorSuccessUsed to represent the token sequence of operation success, such as Result, Progress and other components will use these map tokens.string#52c41a
colorTextDefault text color which comply with W3C standards, and this color is also the darkest neutral color.stringrgba(0,0,0,0.88)
colorTextLightSolidControl the highlight color of text with background color, such as the text in Primary Button components.string#fff
colorTextPlaceholderControl the color of placeholder text.stringrgba(0,0,0,0.25)
colorWarningUsed to represent the warning map token, such as Notification, Alert, etc. Alert or Control component(like Input) will use these map tokens.string#faad14
fontFamilyThe font family of Ant Design prioritizes the default interface font of the system, and provides a set of alternative font libraries that are suitable for screen display to maintain the readability and readability of the font under different platforms and browsers, reflecting the friendly, stable and professional characteristics.string-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'
fontSizeThe most widely used font size in the design system, from which the text gradient will be derived.number14
lineHeightLine height of text.number1.5714285714285714
lineWidthBorder width of base componentsnumber1
marginXSControl the margin of an element, with a small size.number8
motionDurationMidMotion speed, medium speed. Used for medium element animation interaction.string0.2s
motionDurationSlowMotion speed, slow speed. Used for large element animation interaction.string0.3s
motionEaseOutBackPreset motion curve.string
Cubic Bezier Visualizer
cubic-bezier(0.12, 0.4, 0.29, 1.46)External Link Icon
Basic

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

CodeSandbox Icon
Hitu Icon
codepen icon
External Link Icon
Expand Icon
Overflow Count

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

CodeSandbox Icon
Hitu Icon
codepen icon
External Link Icon
Expand Icon
Dynamic

The count will be animated as it changes.

CodeSandbox Icon
Hitu Icon
codepen icon
External Link Icon
Expand Icon
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.

CodeSandbox Icon
Hitu Icon
codepen icon
External Link Icon
Expand Icon
Status

Standalone badge with status.

CodeSandbox Icon
Hitu Icon
codepen icon
External Link Icon
Expand Icon
Ribbon

Use ribbon badge.

CodeSandbox Icon
Hitu Icon
codepen icon
External Link Icon
Expand Icon
Standalone

Used in standalone when children is empty.

CodeSandbox Icon
Hitu Icon
codepen icon
External Link Icon
Expand Icon
Red badge

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

CodeSandbox Icon
Hitu Icon
codepen icon
External Link Icon
Expand Icon
Clickable

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

CodeSandbox Icon
Hitu Icon
codepen icon
External Link Icon
Expand Icon
Size

Set size of numeral Badge.

CodeSandbox Icon
Hitu Icon
codepen icon
External Link Icon
Expand Icon
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.

CodeSandbox Icon
Hitu Icon
codepen icon
External Link Icon
Expand Icon
Custom semantic dom styling

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

CodeSandbox Icon
Hitu Icon
codepen icon
External Link Icon
Expand Icon
6.0.0
5
0
99
99+
10+
999+
5
5

Success
Error
Default
Processing
Warning
Pushes open the window
and raises the spyglass.
Hippies
Pushes open the window
and raises the spyglass.
Hippies
Pushes open the window
and raises the spyglass.
Hippies
Pushes open the window
and raises the spyglass.
Hippies
Pushes open the window
and raises the spyglass.
Hippies
Pushes open the window
and raises the spyglass.
Hippies
Pushes open the window
and raises the spyglass.
Hippies
Pushes open the window
and raises the spyglass.
Hippies
11
25
99+
Link something
5
5
5
Presets
pink
red
yellow
orange
cyan
green
blue
purple
geekblue
magenta
volcano
gold
lime
Custom
#f50
rgb(45, 183, 245)
hsl(102, 53%, 61%)
hwb(205 6% 9%)
55
Card with custom ribbon
This card has a customized ribbon with semantic classNames and styles.
Custom Ribbon
Card with custom ribbon
This card has a customized ribbon with semantic classNames and styles.
Custom Ribbon
5
  • root
    5.7.0
    Root element with relative positioning, inline-block display, and fit-content width for basic layout
  • indicator
    5.7.0
    Indicator element with positioning, z-index, dimensions, colors, fonts, text alignment, background, border-radius, box-shadow, and transition animations for complete badge styling
Pushes open the window
and raises the spyglass.
Hippies
  • root
    6.0.0
    Root element, set relative positioning and wrapper container styles
  • indicator
    6.0.0
    Indicator element, set absolute positioning, padding, background color, border radius and ribbon styles
  • content
    6.0.0
    Content element, set text color and ribbon content display styles