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.


shadcn add · no workarounds · theme neutral (none shipped)Installation
Usage
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.
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.
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.
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.
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
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.
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