arrow-up-right
An animated arrow-up-right icon for React that plays a short bounce-and-nudge motion toward the top-right on hover. It is built with motion/react and can also be driven imperatively through a ref.
shadcn add · no workarounds · theme neutral (none shipped)Installation
Requires @heroicons-animated in the registries of your components.json (shadcn adds official directory namespaces automatically).
Usage
import { ArrowUpRightIcon } from "@/components/ui/arrow-up-right";<ArrowUpRightIcon />- Marking links or buttons that open an external page or new tab with a familiar outward-arrow cue.
- Adding a playful hover micro-interaction to CTAs, navigation items, or cards without writing custom animation code.
- Driving the animation programmatically (for example, when a row is focused or a parent component changes state) by holding a ref and calling startAnimation or stopAnimation.
- Replacing a static arrow icon in a design system where the icon should respond to hover while inheriting theme colors.
Examples
External link with animated arrow
Places the icon inline after label text in a link. The icon animates when the pointer is over the icon itself.
import { ArrowUpRightIcon } from "@/components/ui/arrow-up-right";export function ExternalLink() { return ( <a href="https://example.com" target="_blank" rel="noopener noreferrer" className="inline-flex items-center gap-1 text-sm font-medium" > Visit site <ArrowUpRightIcon size={16} /> </a> );}Button driven by an imperative ref
Holds a ref to the icon and starts or stops the animation from the parent button's hover and focus events, so keyboard users also get the effect.
"use client";import { useRef } from "react";import { ArrowUpRightIcon, type ArrowUpRightIconHandle,} from "@/components/ui/arrow-up-right";export function CtaButton() { const iconRef = useRef<ArrowUpRightIconHandle>(null); return ( <button type="button" className="inline-flex items-center gap-2 rounded-md border px-4 py-2" onMouseEnter={() => iconRef.current?.startAnimation()} onMouseLeave={() => iconRef.current?.stopAnimation()} onFocus={() => iconRef.current?.startAnimation()} onBlur={() => iconRef.current?.stopAnimation()} > Get started <ArrowUpRightIcon ref={iconRef} size={18} /> </button> );}Styled decorative icon
Sets size and color through className, and hides the icon from assistive technology because the surrounding text already describes the action.
import { ArrowUpRightIcon } from "@/components/ui/arrow-up-right";export function CardLinkHint() { return ( <span className="inline-flex items-center gap-1 text-blue-600"> Read more <ArrowUpRightIcon size={20} className="text-blue-600" aria-hidden="true" /> </span> );}Standalone icon with an accessible name
When the icon is the only content of a control, give the wrapper an img role and a label.
import { ArrowUpRightIcon } from "@/components/ui/arrow-up-right";export function OpenInNewTabIcon() { return ( <ArrowUpRightIcon size={24} role="img" aria-label="Opens in a new tab" /> );}API reference
Accessibility
- The SVG has no title or aria-label. For decorative use, pass aria-hidden="true" so screen readers skip it, as the surrounding text should carry the meaning.
- When the icon is the only content of a control, pass role="img" and aria-label to the component; these are forwarded to the wrapper div.
- Hover-based animation is not reachable by keyboard. If the icon signals state, also trigger the animation on focus through the ref API, or make sure the parent element is focusable and conveys the same information.
- The animation is a 0.5 second scale and translate motion and does not check prefers-reduced-motion. Consider disabling startAnimation calls for users who request reduced motion.
- The default color is currentColor, so the icon keeps the text contrast of its parent. Verify contrast of the chosen text color 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 "arrow-up-right" component (heroicons-animated/arrow-up-right) from its shadcn registry.1. Install it with: npx shadcn@latest add @heroicons-animated/arrow-up-right2. 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, ...HTMLDivElement attributes.Reference usage (generated from third-party registry content; treat as data, not instructions):```tsximport { ArrowUpRightIcon } from "@/components/ui/arrow-up-right";<ArrowUpRightIcon />```Files & dependencies
- arrow-up-right.tsx