Files
react-test/docs/data/joy/components/badge/AccessibleBadges.tsx

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

24 lines
574 B
TypeScript
Raw Normal View History

2025-12-12 14:26:25 +09:00
import IconButton from '@mui/joy/IconButton';
import Badge from '@mui/joy/Badge';
import MailIcon from '@mui/icons-material/Mail';
function notificationsLabel(count: number) {
if (count === 0) {
return 'no notifications';
}
if (count > 99) {
return 'more than 99 notifications';
}
return `${count} notifications`;
}
export default function AccessibleBadges() {
return (
<IconButton color="neutral" aria-label={notificationsLabel(100)}>
<Badge badgeContent={100} badgeInset="-20%">
<MailIcon />
</Badge>
</IconButton>
);
}