Badge 徽章
徽章组件会在其子项(们)的右上角生成一个小徽章。
4
Press Enter to start editing
44
Press Enter to start editing
徽章组件的可见性
以下是自定义组件的一个示例。 You can learn more about this in the overrides documentation page.
Press Enter to start editing
1
The badge hides automatically when badgeContent
is zero. 您可以使用 showZero
属性覆盖它。
0
Press Enter to start editing
9999+999+
Press Enter to start editing
Press Enter to start editing
Press Enter to start editing
11299+999+
<Badge
anchorOrigin={{
vertical: 'top',
horizontal: 'right',
}}
>
Accessibility
You can't rely on the content of the badge to be announced correctly. You should provide a full description, for instance, with aria-label
:
Press Enter to start editing
Unstyled
The component also comes with an unstyled version. It's ideal for doing heavy customizations and minimizing bundle size.