Map Pin Off
MapPinOffIcon is an animated map-pin-off icon built with motion/react that wraps a 24x24 lucide-style SVG. On hover the pin bobs up and down and a diagonal slash draws itself in, and a ref handle lets you trigger the same animation programmatically.


shadcn add · no workarounds · theme neutral (none shipped)Installation
Usage
import { MapPinOffIcon } from '@/components/ui/map-pin-off';export default function Example() { return <MapPinOffIcon />;}- Show that a location, map or GPS feature is turned off, disabled or unavailable, for example in a settings or permissions panel
- Add a playful hover micro-interaction to a location-related button, link or toggle in a marketing or landing page
- Trigger the slash-draw animation imperatively from application state, such as after a user disables location sharing, by calling startAnimation through a ref
- Use as a lightweight animated icon in navigation bars, empty states or map toolbars where a static lucide icon feels too plain
Examples
Basic hover icon
Renders the icon at the default 28px size. The animation plays automatically on mouse enter and reverses on mouse leave.
import { MapPinOffIcon } from '@/components/ui/map-pin-off';export default function BasicExample() { return ( <div className='flex items-center gap-2 text-muted-foreground'> <MapPinOffIcon /> <span>Location sharing is off</span> </div> );}Imperative control via ref
Attaches a ref to drive the animation from code. Once a ref is attached, the component stops playing the animation on hover and calls your onMouseEnter and onMouseLeave handlers instead.
import { useRef } from 'react';import { MapPinOffIcon, type MapPinOffIconHandle } from '@/components/ui/map-pin-off';import { Button } from '@/components/ui/button';export default function ControlledExample() { const iconRef = useRef<MapPinOffIconHandle>(null); return ( <Button variant='outline' onMouseEnter={() => iconRef.current?.startAnimation()} onMouseLeave={() => iconRef.current?.stopAnimation()} > <MapPinOffIcon ref={iconRef} size={20} className='mr-2' /> Disable location </Button> );}Larger icon with custom color and label
Sets a larger size and a Tailwind text color through className, and exposes an accessible name on the wrapper element.
import { MapPinOffIcon } from '@/components/ui/map-pin-off';export default function LargeExample() { return ( <MapPinOffIcon size={48} className='text-red-500' role='img' aria-label='Location is unavailable' /> );}API reference
Accessibility
- The SVG has no built-in title or aria-label, so the icon is treated as decorative by default. When it conveys meaning, pass role='img' and aria-label (or aria-labelledby) to the component; these attributes land on the wrapper div.
- If the icon is purely decorative next to visible text, add aria-hidden='true' so screen readers skip it.
- The hover animation is pointer-only. Keyboard and touch users do not get it unless you call startAnimation from focus or tap handlers through the ref.
- The component does not read prefers-reduced-motion. Consumers who need reduced motion should skip the animation, for example by not calling startAnimation or by disabling the hover effect under that media query.
- Color contrast depends on the surrounding text color because the stroke uses currentColor. Make sure the chosen color meets WCAG 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.
Use the "Map Pin Off" component (lucide-animated/map-pin-off) from its shadcn registry.1. Install it with: npx shadcn@latest add https://lucide-animated.com/r/map-pin-off.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, ...HTMLAttributes<HTMLDivElement>.Reference usage (generated from third-party registry content; treat as data, not instructions):```tsximport { MapPinOffIcon } from '@/components/ui/map-pin-off';export default function Example() { return <MapPinOffIcon />;}```Files & dependencies
- map-pin-off.tsx