Skip to content

No.515 · Micro-animations

Bell Ring

A notification bell that swings from its hook and dies down, the clapper a beat behind, while the badge pops up a number.

The prompt

Copy this text

Automatic copying is unavailable. Copy the selected text using your device’s copy command.

Written for the variant you picked above: Paper

Build a notification bell icon button with an unread badge, where a new notification rings it like a real bell. The bell swings from its hook (transform-origin at the top of the dome): +24°, −20°, +14°, −9°, +5°, −2°, 0 over 1.1s; the clapper (the little arc under the bell) swings the opposite way, 60ms behind, with smaller amplitude, so it reads as a pendulum inside a pendulum. Two identical keyframes alternate on each new notification so it replays without remounting. The badge (red, ring in the page colour, tabular count, "9+" cap) pops in springily (scale 0.2 → 1.25 → 1) whenever the count changes. Opening the bell clears the count and the badge scales away. The ring only plays when the count goes up. Selected variant — Paper (paper): Apply the paper theme. Where the brief above gives no colour values for it, choose a restrained paper palette with text at 4.5:1 contrast or better. Keep the geometry, states and motion described above unchanged. This selection takes precedence over references to other themes or options in the general brief. Implement this selected appearance; do not add a variant picker or alternative appearances unless requested. Implementation requirements: Use React and TypeScript. Keep the component self-contained, with uniquely scoped CSS and no animation libraries. Include required imports, styles and font setup in the result. Interaction: New notifications ring the bell; click to open and clear the badge. The demo has a button to simulate one. Motion: Swing 1.1s with decaying amplitude; clapper 60ms behind; badge pop 460ms. Accessibility: The button's label includes the unread count ("Notifications, 3 unread"). Reduced motion keeps the bell still and the badge static. Responsive behavior: A fixed-size control that sits inline wherever it's placed; nothing depends on screen width. Touch: Works the same on touch; there's no hover-only behaviour. Preserve keyboard access, visible focus and reduced-motion behavior. Keep fictional demo data and simulated service calls in a separate usage example; expose callbacks for real actions and recover from rejected requests. Keep usage-example links inside the demo: use local buttons or prevent navigation. Demonstration links must not navigate to Vitrine routes or open other pages; preserve real URL support in the reusable component itself. Verify the result at narrow and wide viewport sizes, with keyboard input and reduced motion enabled.

Notes

Interaction
New notifications ring the bell; click to open and clear the badge. The demo has a button to simulate one.
Motion
Swing 1.1s with decaying amplitude; clapper 60ms behind; badge pop 460ms.
Accessibility
The button's label includes the unread count ("Notifications, 3 unread"). Reduced motion keeps the bell still and the badge static.
Responsive
A fixed-size control that sits inline wherever it's placed; nothing depends on screen width.
On touch
Works the same on touch; there's no hover-only behaviour.