Badge
Also called pill, status badge, or notification badge
A small rounded label that marks a status or a count, like New, Beta, Failed, or the red number on an inbox icon.
import { motion } from 'motion/react';
// The word carries the meaning too, so it reads without the color.
const STATUS = {
live: 'bg-emerald-500/15 text-emerald-700 dark:text-emerald-300',
beta: 'bg-violet-500/15 text-violet-700 dark:text-violet-300',
failed: 'bg-red-500/15 text-red-700 dark:text-red-300'
};
const PILL = 'rounded-full px-2 py-0.5 text-xs font-medium capitalize';
// A quick, springy pop when the count changes draws the eye without shouting.
const BUMP = { type: 'spring', stiffness: 600, damping: 15 } as const;
type Props = { name: string; status: keyof typeof STATUS; unread: number };
export function ProjectHeader({ name, status, unread }: Props) {
return (
<header className='flex w-96 items-center justify-between'>
<div className='flex items-center gap-2'>
<h2 className='font-semibold'>{name}</h2>
<span className={`${PILL} ${STATUS[status]}`}>{status}</span>
</div>
<button
type='button'
aria-label={`Notifications, ${unread} unread`}
className='relative rounded-lg p-2 hover:bg-muted'
>
<svg
viewBox='0 0 24 24'
aria-hidden='true'
className='size-5 fill-none stroke-current stroke-[1.75]'
>
<path d='M6 8a6 6 0 0 1 12 0c0 7 3 9 3 9H3s3-2 3-9' />
<path d='M10.3 21a1.94 1.94 0 0 0 3.4 0' />
</svg>
{unread > 0 && (
// A new key remounts the badge, which replays the pop. Hidden at 0, capped at 99+.
<motion.span
key={unread}
initial={{ scale: 1.2 }}
animate={{ scale: 1 }}
transition={BUMP}
aria-hidden='true'
className='absolute top-0.5 right-0.5 min-w-4.5 rounded-full bg-red-600 px-1 text-[11px] leading-4.5 font-semibold text-white tabular-nums'
>
{unread > 99 ? '99+' : unread}
</motion.span>
)}
</button>
</header>
);
}Add a notification badge to the bell icon in the header: a red circle on its top-right corner showing the unread count, hidden at 0 and capped at 99+. When the count changes, pop it to 1.2× scale and back with a spring over about 200ms. Also give each project row a status badge (Live in green, Beta in purple, Failed in red) as a small rounded pill with 12px text.
Paste into Layerwise or any AI coding tool.
What is Badge?
A badge is a word or number in a small, rounded container. Status badges sit next to an item and describe it (New, Beta, Paid, Failed), with a color that matches the meaning. Count badges sit on the corner of an icon and show how many unread messages or notifications are waiting.
Use badges sparingly so they stay noticeable. Keep the text to one or two words, hide a count badge at zero, and cap large counts at “99+”. Let the word carry the meaning as well as the color, so people who cannot tell red from green still understand it.
When a count changes, a quick bump to about 1.2× scale for 150 to 200ms draws the eye without being loud. Badges are read-only labels; if clicking one should do something, use a button or a removable chip instead.
Often confused with
- Tag input
- Chips in a tag input are values a person typed and can remove. A badge is a read-only label the app shows about an item.
Related terms
All termsAvatar stack
A row of overlapping profile pictures that shows who is on a project or in a document, with a +3 counter for everyone who doesn’t fit.
Pop in
An entrance animation where an element scales up past its full size and settles back, giving it a quick, springy arrival.
Pulse animation
A soft, repeating beat or expanding ring that draws the eye to a live status, a new notification, or something that needs attention.
Color contrast
How much text stands out from its background, measured as a ratio from 1:1 to 21:1 and checked against the WCAG levels AA and AAA.
Build it with Layerwise
Describe your app, watch it run in a live preview, and publish it with a database, storage, and sign-in built in.