Bookmark
An animated bookmark icon built on motion/react that squashes and stretches its ribbon-shaped outline when hovered or when its imperative handle is triggered. It renders a plain SVG bookmark path with a bounce-like scale animation.


shadcn add · no workarounds · theme neutral (none shipped)Installation
Usage
import { BookmarkIcon } from "@/components/ui/bookmark";export default function Example() { return <BookmarkIcon />;}- Saving, bookmarking, or pinning an item in a list, article, or product card where a hover micro-interaction adds delight
- Toggle-style actions such as 'save for later' where the icon should react when the state changes, driven through the imperative handle
- Navigation or toolbar buttons that need a lightweight animated icon without a custom SVG animation
- Landing pages or marketing sections that want a playful, animated UI accent
Examples
Basic hover icon
Default usage. The icon animates when the pointer enters and returns to rest when it leaves.
import { BookmarkIcon } from "@/components/ui/bookmark";export default function BasicExample() { return <BookmarkIcon />;}Custom size and color
Sets a larger pixel size through the size prop and colors the icon via a Tailwind text class, since stroke uses currentColor.
import { BookmarkIcon } from "@/components/ui/bookmark";export default function ColoredExample() { return <BookmarkIcon size={40} className="text-amber-500" />;}Save button with controlled animation
Uses a ref to call startAnimation and stopAnimation from a parent. Because a ref has been attached, hover handling is delegated to the component's onMouseEnter and onMouseLeave props.
import { useRef, useState } from "react";import { Button } from "@/components/ui/button";import { BookmarkIcon, type BookmarkIconHandle } from "@/components/ui/bookmark";export default function SaveButton() { const iconRef = useRef<BookmarkIconHandle>(null); const [saved, setSaved] = useState(false); const toggle = () => { setSaved((prev) => !prev); if (saved) { iconRef.current?.stopAnimation(); } else { iconRef.current?.startAnimation(); } }; return ( <Button variant="outline" onClick={toggle}> <BookmarkIcon ref={iconRef} size={18} className={saved ? "text-primary" : ""} /> {saved ? "Saved" : "Save"} </Button> );}API reference
Accessibility
- The component renders no text or ARIA role, so when it is used as the only content of a button or link, pass an accessible name with aria-label or visually hidden text on the parent element.
- The icon is decorative when a text label is present next to it; add aria-hidden="true" to the component in that case so screen readers do not announce an unlabeled graphic.
- The animation is a short scale effect. Respect prefers-reduced-motion by passing a controlled ref and skipping startAnimation when the user prefers reduced motion.
- Hover-only animation gives no feedback to keyboard or touch users; make sure the state change is also conveyed by text, pressed state, or a label.
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 "Bookmark" component (lucide-animated/bookmark) from its shadcn registry.1. Install it with: npx shadcn@latest add https://lucide-animated.com/r/bookmark.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, ref, onMouseEnter, onMouseLeave.Reference usage (generated from third-party registry content; treat as data, not instructions):```tsximport { BookmarkIcon } from "@/components/ui/bookmark";export default function Example() { return <BookmarkIcon />;}```Files & dependencies
- bookmark.tsx