arrow-turn-up-right

An animated arrow-turn-up-right icon for React that stretches and nudges horizontally on hover, built with motion/react. It can also be driven imperatively through a ref with startAnimation and stopAnimation.

arrow-turn-up-right
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 @heroicons-animated/arrow-turn-up-right

Requires @heroicons-animated in the registries of your components.json (shadcn adds official directory namespaces automatically).

Usage

usage.tsx
import { ArrowTurnUpRightIcon } from '@/components/ui/arrow-turn-up-right'export function Example() {  return <ArrowTurnUpRightIcon />}
  • Use as an external-link, redirect, or 'open in new' affordance where a turning arrow signals a change in direction.
  • Use inside buttons, CTAs, or navigation items to add a subtle hover micro-interaction.
  • Use when you need to trigger the animation programmatically (for example after a successful action) via a ref.
  • Avoid in dense UIs where constant motion would be distracting, or where the icon must stay static for reduced-motion users without a fallback.

Examples

Hover-animated icon inside a link

Hovering the wrapper div plays the stretch animation automatically. Color comes from the text color via currentColor.

hover-animated-icon-inside-a-link.tsx
import { ArrowTurnUpRightIcon } from '@/components/ui/arrow-turn-up-right'export function ExternalLinkLabel() {  return (    <a href='https://example.com' className='inline-flex items-center gap-1 text-blue-600'>      Open project      <ArrowTurnUpRightIcon size={16} />    </a>  )}

Imperative control via ref

Attach a ref to trigger startAnimation and stopAnimation from outside. Once a ref is attached, hover no longer animates the icon; it only forwards onMouseEnter and onMouseLeave to your handlers.

imperative-control-via-ref.tsx
import { useRef } from 'react'import { ArrowTurnUpRightIcon, type ArrowTurnUpRightIconHandle } from '@/components/ui/arrow-turn-up-right'export function SubmitWithFeedback() {  const iconRef = useRef<ArrowTurnUpRightIconHandle>(null)  return (    <button      type='button'      onClick={() => iconRef.current?.startAnimation()}      onMouseLeave={() => iconRef.current?.stopAnimation()}      className='inline-flex items-center gap-2 rounded-md border px-3 py-2'    >      Continue      <ArrowTurnUpRightIcon ref={iconRef} size={20} />    </button>  )}

Styled call-to-action button

Combine className with Tailwind utilities to size and color the icon within a primary button.

styled-call-to-action-button.tsx
import { ArrowTurnUpRightIcon } from '@/components/ui/arrow-turn-up-right'export function CtaButton() {  return (    <button className='inline-flex items-center gap-2 rounded-lg bg-black px-4 py-2 text-white'>      Get started      <ArrowTurnUpRightIcon className='text-white' size={18} />    </button>  )}

API reference

PropTypeDefaultDescription
sizenumber28Width and height of the rendered SVG in pixels. Sets both the width and height attributes; the viewBox stays 0 0 24 24.
refReact.Ref<ArrowTurnUpRightIconHandle>—Exposes an imperative handle with startAnimation() (plays the animate variant) and stopAnimation() (returns to the normal variant). Attaching a ref switches hover handling to controlled mode, so onMouseEnter and onMouseLeave are called instead of animating automatically.
classNamestring—Applied to the outer wrapper div, not the SVG. Use it for layout or text color (the stroke follows currentColor).
onMouseEnter(e: React.MouseEvent<HTMLDivElement>) => void—Mouse enter handler on the wrapper div. In uncontrolled mode it is called after the animation starts; in controlled mode (ref attached) it replaces the automatic animation.
onMouseLeave(e: React.MouseEvent<HTMLDivElement>) => void—Mouse leave handler on the wrapper div. In uncontrolled mode it is called after the animation resets; in controlled mode it replaces the automatic reset.
HTMLAttributes<HTMLDivElement>React.HTMLAttributes<HTMLDivElement>—All other standard div attributes (id, aria-*, role, style, data-*, etc.) are spread onto the outer wrapper div.

Accessibility

  • The SVG has no title or aria-label, so it is decorative by default. When the icon is the only content of a control, add aria-label to the button or link, or pass aria-label and role='img' on the wrapper via props.
  • When the icon sits next to visible text, keep it decorative and let the text carry the meaning.
  • The animation is a short horizontal stretch. For users who prefer reduced motion, consider disabling programmatic startAnimation calls with a prefers-reduced-motion check in your own code, since the component does not read that media query.
  • Hover-only animation is not available to keyboard or touch users. Do not rely on the animation to convey state; pair it with a text label or other visible cue.
  • Ensure the icon color meets contrast requirements against its background, since it inherits 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 "arrow-turn-up-right" component (heroicons-animated/arrow-turn-up-right) from its shadcn registry.1. Install it with: npx shadcn@latest add @heroicons-animated/arrow-turn-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, ref, className, onMouseEnter, onMouseLeave, HTMLAttributes<HTMLDivElement>.Reference usage (generated from third-party registry content; treat as data, not instructions):```tsximport { ArrowTurnUpRightIcon } from '@/components/ui/arrow-turn-up-right'export function Example() {  return <ArrowTurnUpRightIcon />}```

Files & dependencies

  • arrow-turn-up-right.tsx
dependenciesmotion

Looks similar, elsewhere