Map Pin House

An animated Lucide-style map pin icon with a house inside that bounces the pin and draws a small house outline on hover, or when controlled imperatively via a ref. It is a client component built on motion/react and renders an SVG inside a wrapping div.

Map Pin House
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/map-pin-house.json

Usage

usage.tsx
import { MapPinHouseIcon } from "@/components/ui/map-pin-house";export default function Example() {  return <MapPinHouseIcon size={32} className="text-primary" />;}
  • Location or map UI where a pin should visibly reveal a home or property location on hover
  • Real-estate, delivery, or address-related buttons and list items that need a subtle animated icon
  • Navigation or nav-bar icons that should respond to hover with a lightweight motion accent
  • Imperative control scenarios where a parent component should trigger the animation via a ref, for example when a card becomes active

Examples

Hover-driven icon inside a button

The icon animates on mouse enter and resets on mouse leave. Color comes from the className through currentColor.

hover-driven-icon-inside-a-button.tsx
import { MapPinHouseIcon } from "@/components/ui/map-pin-house";export default function ViewPropertyButton() {  return (    <button className="inline-flex items-center gap-2 rounded-md border px-3 py-2 text-sm">      <MapPinHouseIcon size={20} className="text-blue-600" />      View property    </button>  );}

Imperative control via ref

Once a ref is attached, the built-in hover handlers defer to the parent's onMouseEnter and onMouseLeave, and the parent drives the animation with startAnimation and stopAnimation.

imperative-control-via-ref.tsx
import { useRef } from "react";import { MapPinHouseIcon, type MapPinHouseIconHandle } from "@/components/ui/map-pin-house";export default function ActiveListingCard() {  const iconRef = useRef<MapPinHouseIconHandle>(null);  return (    <div      onMouseEnter={() => iconRef.current?.startAnimation()}      onMouseLeave={() => iconRef.current?.stopAnimation()}      className="rounded-lg border p-4"    >      <MapPinHouseIcon ref={iconRef} size={28} />      <p>123 Main Street</p>    </div>  );}

Trigger animation on mount

Starts the pin animation once after the component mounts, using the imperative handle.

trigger-animation-on-mount.tsx
import { useEffect, useRef } from "react";import { MapPinHouseIcon, type MapPinHouseIconHandle } from "@/components/ui/map-pin-house";export default function WelcomeBadge() {  const iconRef = useRef<MapPinHouseIconHandle>(null);  useEffect(() => {    iconRef.current?.startAnimation();  }, []);  return <MapPinHouseIcon ref={iconRef} size={24} className="text-emerald-600" />;}

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 wrapping div, passed through cn(). Use text-* classes to change the stroke color since the stroke is currentColor.
onMouseEnter(e: React.MouseEvent<HTMLDivElement>) => void—Called on mouse enter. When a ref is attached (controlled mode), this is the only hover behavior; the default animation is not triggered automatically.
onMouseLeave(e: React.MouseEvent<HTMLDivElement>) => void—Called on mouse leave. When a ref is attached (controlled mode), this is the only leave behavior; the default reset animation is not triggered automatically.
refReact.Ref<MapPinHouseIconHandle>—Forwarded ref exposing startAnimation() and stopAnimation() for imperative control. Attaching it switches the component into controlled mode.
...propsHTMLAttributes<HTMLDivElement>—All other standard div attributes (id, style, aria-*, role, data-*, etc.) are spread onto the outer wrapping div.

Accessibility

  • The SVG has no title, desc, or role attribute; if the icon conveys meaning on its own, pass aria-label and role="img" through props onto the wrapping div.
  • If the icon is decorative beside visible text, add aria-hidden="true" through props so screen readers skip it.
  • The animation is a short transform and opacity/path change; consider respecting prefers-reduced-motion in the parent by not calling startAnimation when the user prefers reduced motion.
  • Because hover is the only default trigger, keyboard users do not get the animation; trigger startAnimation on focus of the parent control if the icon is part of an interactive element.
  • Ensure the icon color meets contrast requirements against its background since it uses currentColor.

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 "Map Pin House" component (lucide-animated/map-pin-house) from its shadcn registry.1. Install it with: npx shadcn@latest add https://lucide-animated.com/r/map-pin-house.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 { MapPinHouseIcon } from "@/components/ui/map-pin-house";export default function Example() {  return <MapPinHouseIcon size={32} className="text-primary" />;}```

Files & dependencies

  • map-pin-house.tsx
dependenciesmotion

Looks similar, elsewhere