Coffee

An animated coffee-cup icon built on motion/react where three steam lines rise and fade in a looping sequence when hovered or controlled imperatively. It renders a Lucide-style outline SVG and is exposed as a forwardRef component with startAnimation and stopAnimation handles.

Coffee
LIVE · running in a sandboxed iframe
Installed with plain shadcn add · no workarounds · theme neutral (none shipped)
See how it was built

Installation

pnpm dlx shadcn@latest add https://lucide-animated.com/r/coffee.json

Usage

usage.tsx
import { CoffeeIcon } from "@/components/ui/coffee";export function Example() {  return <CoffeeIcon />;}
  • Adding a hover-triggered steam animation to a coffee, cafe, or beverage menu item or drink-order button
  • Showing a loading or brewing state in a navigation bar, dashboard card, or onboarding step where a warm, playful icon fits
  • Driving the steam animation programmatically from parent state through a ref, such as when a checkout or brew process starts
  • Replacing a static coffee icon in a landing page feature list where subtle motion adds polish

Examples

Hover-animated icon in a menu item

Renders the icon beside a label. Hovering the wrapper triggers the steam animation through the built-in mouse handlers.

hover-animated-icon-in-a-menu-item.tsx
import { CoffeeIcon } from "@/components/ui/coffee";export function CoffeeMenuItem() {  return (    <button type="button" className="flex items-center gap-2 text-sm font-medium">      <CoffeeIcon size={20} className="text-amber-700" />      Espresso    </button>  );}

Imperative control through a ref

Uses the forwardRef handle to start the steam loop when a brew begins and stop it when the brew finishes.

imperative-control-through-a-ref.tsx
import { useRef } from "react";import { CoffeeIcon, type CoffeeIconHandle } from "@/components/ui/coffee";export function BrewStatus({ brewing }: { brewing: boolean }) {  const iconRef = useRef<CoffeeIconHandle>(null);  return (    <div      onClick={() => {        if (brewing) {          iconRef.current?.stopAnimation();        } else {          iconRef.current?.startAnimation();        }      }}    >      <CoffeeIcon ref={iconRef} size={32} />    </div>  );}

Icon inside a call-to-action button

Places the animated icon inside a styled button so the whole control reacts to hover.

icon-inside-a-call-to-action-button.tsx
import { CoffeeIcon } from "@/components/ui/coffee";export function OrderButton() {  return (    <button      type="button"      className="inline-flex items-center gap-2 rounded-md bg-stone-900 px-4 py-2 text-white"    >      <CoffeeIcon size={18} />      Order coffee    </button>  );}

API reference

PropTypeDefaultDescription
sizenumber28Width and height of the SVG in pixels.
classNamestring—Class names applied to the wrapping div, merged with cn().
onMouseEnter(e: React.MouseEvent<HTMLDivElement>) => void—Mouse enter handler. When the ref handle is attached, it is called instead of the built-in animation trigger.
onMouseLeave(e: React.MouseEvent<HTMLDivElement>) => void—Mouse leave handler. When the ref handle is attached, it is called instead of the built-in animation reset.
refReact.Ref<CoffeeIconHandle>—Exposes startAnimation() and stopAnimation() for imperative control of the steam animation.
...propsHTMLAttributes<HTMLDivElement>—All other standard div attributes are spread onto the wrapping div, such as id, style, aria-* and data-* attributes.

Accessibility

  • The component renders a decorative SVG with no title or role; if the icon conveys meaning on its own, pass aria-label and role="img" through props to the wrapper div.
  • When the icon sits next to visible text, leave it unlabeled so screen readers do not announce it twice.
  • The animation is motion only and runs on hover or on demand; for users with reduced-motion preferences, consider skipping the startAnimation call in your own code, since the component does not check prefers-reduced-motion itself.
  • Because the wrapper is a div with mouse handlers, keyboard users do not get the hover effect; trigger startAnimation from focus or click handlers when the icon is part of an interactive control.
  • The steam strokes use currentColor, so ensure the surrounding text color has sufficient contrast against its background.

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.

prompt.md
Use the "Coffee" component (lucide-animated/coffee) from its shadcn registry.1. Install it with: npx shadcn@latest add https://lucide-animated.com/r/coffee.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 { CoffeeIcon } from "@/components/ui/coffee";export function Example() {  return <CoffeeIcon />;}```

Files & dependencies

  • coffee.tsx
dependenciesmotion

Looks similar, elsewhere