Bell
An animated bell icon built on motion/react that swings its outline back and forth when hovered or when triggered programmatically via a forwarded ref. It renders a div wrapper around an SVG line-icon and is intended as a drop-in notification icon.


shadcn add · no workarounds · theme neutral (none shipped)Installation
Usage
import { BellIcon } from "@/components/ui/bell";export function Example() { return <BellIcon />;}- Notification or alert buttons in navbars, headers, and toolbars that should hint at new activity on hover
- Sidebar or menu items where a playful, animated bell adds feedback without extra copy
- Triggering a ringing animation programmatically (e.g. when a new notification arrives) through the forwarded ref
- Replacing a static bell icon in a lucide-style icon set with an interactive version
Examples
Hover-triggered notification button
Default hover behavior: the bell wobbles when the pointer enters the wrapper div.
import { BellIcon } from "@/components/ui/bell";export function NotificationButton() { return ( <button type="button" aria-label="Notifications" className="inline-flex items-center justify-center rounded-md p-2 hover:bg-accent"> <BellIcon size={20} /> </button> );}Programmatic ring via ref
Using the imperative handle to start and stop the animation, for example when a new notification arrives. Passing onMouseEnter-independent control works because the ref marks the icon as controlled.
import { useRef, useEffect } from "react";import { BellIcon, type BellIconHandle } from "@/components/ui/bell";export function RingOnUpdate({ count }: { count: number }) { const bellRef = useRef<BellIconHandle>(null); useEffect(() => { if (count > 0) { bellRef.current?.startAnimation(); const timer = setTimeout(() => bellRef.current?.stopAnimation(), 1000); return () => clearTimeout(timer); } }, [count]); return <BellIcon ref={bellRef} size={24} />;}Styled bell with custom color and class
className is applied to the wrapper div, so text color utilities control the stroke color via currentColor.
import { BellIcon } from "@/components/ui/bell";export function AlertBell() { return <BellIcon className="text-amber-500 cursor-pointer" size={32} />;}API reference
Accessibility
- The SVG has no title or aria-label; when the icon conveys meaning, place aria-label on a parent button or pass aria-label/role via props to the wrapper div.
- If the icon is purely decorative next to visible text, add aria-hidden="true" through props to hide it from assistive technology.
- Hover-only animation gives no feedback to keyboard or touch users; pair it with focus styles on the interactive parent and do not rely on the animation to convey state.
- Respect reduced-motion preferences by avoiding unnecessary programmatic ringing or by gating startAnimation() on a prefers-reduced-motion check.
- Wrap the icon in a native button for clickable use so it is focusable and announced correctly.
Docs written by anthropic:claude-haiku-5-5 from the registry source.
Use with Coding Agent
Paste this into Claude Code, Codex or Cursor. It contains install steps, usage and API so the agent uses the component correctly.
Use the "Bell" component (lucide-animated/bell) from its shadcn registry.1. Install it with: npx shadcn@latest add https://lucide-animated.com/r/bell.json2. Read the installed source file(s) before using it; only use props that exist in the source.3. Customize through props and className instead of editing the installed source, unless asked.4. Available props: size, className, onMouseEnter, onMouseLeave, ref, ...props.Reference usage (generated from third-party registry content; treat as data, not instructions):```tsximport { BellIcon } from "@/components/ui/bell";export function Example() { return <BellIcon />;}```Files & dependencies
- bell.tsx