Thermometer

ThermometerIcon is an animated thermometer SVG icon that gently sways left and right when hovered, built with motion/react. It can also be controlled imperatively through a ref with startAnimation and stopAnimation.

Thermometer
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/thermometer.json

Usage

usage.tsx
import { ThermometerIcon } from "@/components/ui/thermometer";export function Example() {  return <ThermometerIcon className="text-red-500" />;}
  • Show temperature, weather, or climate information with a lively icon that reacts to hover.
  • Add a playful micro-interaction to a feature card, settings row, or dashboard widget that displays a temperature reading.
  • Use as an animated trigger inside a button or link, where the wobble signals that the element is interactive.
  • Drive the wobble programmatically through a ref, for example to animate the icon when fresh data arrives.

Examples

Basic hover icon

Renders the icon with default size 28. Hovering the icon plays the wobble animation.

basic-hover-icon.tsx
import { ThermometerIcon } from "@/components/ui/thermometer";export function BasicThermometer() {  return <ThermometerIcon />;}

Custom size and color

Sets a larger size and colors the icon through className, since the stroke uses currentColor.

custom-size-and-color.tsx
import { ThermometerIcon } from "@/components/ui/thermometer";export function HotThermometer() {  return <ThermometerIcon size={40} className="text-orange-500" />;}

Imperative control via ref

Uses the ref handle to start the wobble when a refresh button is clicked and stop it after one second.

imperative-control-via-ref.tsx
import { useRef } from "react";import { ThermometerIcon, type ThermometerIconHandle } from "@/components/ui/thermometer";export function WeatherRefresh() {  const iconRef = useRef<ThermometerIconHandle>(null);  const handleRefresh = () => {    iconRef.current?.startAnimation();    setTimeout(() => iconRef.current?.stopAnimation(), 1000);  };  return (    <div className="flex items-center gap-3">      <ThermometerIcon ref={iconRef} />      <button type="button" onClick={handleRefresh}>        Refresh temperature      </button>    </div>  );}

Inside a labeled list item

Places the icon beside text in a settings-style row, with the icon marked decorative since the label carries the meaning.

inside-a-labeled-list-item.tsx
import { ThermometerIcon } from "@/components/ui/thermometer";export function TemperatureUnitRow() {  return (    <div className="flex items-center gap-2 text-sm">      <ThermometerIcon size={20} aria-hidden="true" />      <span>Temperature unit: Celsius</span>    </div>  );}

API reference

PropTypeDefaultDescription
sizenumber28Width and height of the SVG in pixels. Applied to both the width and height attributes.
classNamestring—Class names applied to the outer wrapper div through cn(). Use it to set color via text utilities, margins, or other layout styles.
onMouseEnter(event: React.MouseEvent<HTMLDivElement>) => void—Mouse enter handler on the wrapper div. It is called for you only when no ref is attached. When a ref is attached, the component calls this handler instead of starting the animation automatically.
onMouseLeave(event: React.MouseEvent<HTMLDivElement>) => void—Mouse leave handler on the wrapper div. Same behavior as onMouseEnter: it runs in place of the automatic reset when a ref is attached.
refReact.Ref<ThermometerIconHandle>—Forwarded ref exposing startAnimation() and stopAnimation(). Attaching a ref switches the component into controlled mode, so hover no longer triggers the animation automatically.
...propsHTMLAttributes<HTMLDivElement>—All other standard div attributes, such as id, style, aria-* and data-* attributes, are spread onto the wrapper div.

Accessibility

  • The SVG has no title, role, or aria-label, so it carries no accessible name by itself. Put a text label next to it, or pass aria-label on the wrapper div together with role="img" when the icon conveys information on its own.
  • If the icon is purely decorative, pass aria-hidden="true" through props so screen readers skip it.
  • When the icon is the only content of an interactive element, give that element an accessible name with aria-label or visually hidden text, because the icon itself is not labeled.
  • The source does not check prefers-reduced-motion. If you need it, wrap the controls in a media-query check or skip the start call when the user prefers reduced motion.
  • Hover-only animation gives no feedback to keyboard or touch users. Do not rely on it to convey state; pair it with a visible text or status change.

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 "Thermometer" component (lucide-animated/thermometer) from its shadcn registry.1. Install it with: npx shadcn@latest add https://lucide-animated.com/r/thermometer.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 { ThermometerIcon } from "@/components/ui/thermometer";export function Example() {  return <ThermometerIcon className="text-red-500" />;}```

Files & dependencies

  • thermometer.tsx
dependenciesmotion

Looks similar, elsewhere