无样式的徽章
徽章组件会在其子项(们)的右上角生成一个小徽章。
import BadgeUnstyled from '@mui/base/BadgeUnstyled';
5
徽章的可见性
徽章组件的隐显可以通过 invisible
属性来设置。 如果徽章不可见,那么它会被应用 MuiBadge-invisible
类。 It is up to the developer to provide styles that actually hide the badge.
1
1
The badge hides automatically when badgeContent
is zero. You can override this with the showZero
prop.
0
<StyledBadge badgeContent={0}>
<MailIcon />
</StyledBadge>
<StyledBadge badgeContent={0} showZero>
<MailIcon />
</StyledBadge>
9999+999+
<StyledBadge badgeContent={99}>
<MailIcon />
</StyledBadge>
<StyledBadge badgeContent={100}>
<MailIcon />
</StyledBadge>
<StyledBadge badgeContent={1000} max={999}>
<MailIcon />
</StyledBadge>
99+