React component for shadcn/ui
Animated Arrow
A copy-paste React animated arrow for buttons and links with a CSS slide transition, keyboard focus feedback, and reduced-motion support.
Animated Arrow is a lightweight React arrow for shadcn/ui buttons and links that slides forward on hover and keyboard focus. Use it on calls to action, "Read more" links, and next-step buttons to show where a click leads.
It clips two Lucide arrow icons inside a compact viewport, then slides the track when the parent is hovered or receives visible keyboard focus. The effect uses Tailwind CSS rather than a JavaScript animation runtime, so it is easy to restyle for shadcn/ui projects.
Features
- Adds a sliding arrow transition to React buttons and links.
- Uses a named Tailwind group so the trigger stays scoped to this component.
- Accepts a
classNamefor size, color, rotation, and background changes. - Mirrors hover feedback for keyboard focus.
- Disables the movement when the user prefers reduced motion.
Installation
pnpm dlx shadcn@latest add @tentui/animated-arrow
Usage
Add group/animated-arrow to the parent that should trigger the animation.
import { AnimatedArrow } from "@/components/animated-arrow";<button
type="button"
className="group/animated-arrow inline-flex items-center gap-2"
>
Learn more
<AnimatedArrow />
</button>Use the component inside an interactive parent such as a link or button. The arrow is decorative and hidden from assistive technologies, so the parent still needs visible text or an accessible label that describes the action.
How the animation works
The component places two identical arrows on a track that is twice as wide as the visible container. The track begins translated by half its width. Hovering or focusing the named parent group returns the track to its starting position, which makes one arrow replace the other without changing layout.
Because the transition is CSS-only, you can tune its duration and easing in the
component source. Keep the parent class group/animated-arrow; a plain group
will not activate the scoped variants used by the arrow.
For more patterns that respect motion preferences, read How to Add Animations to shadcn/ui Components.
API reference
FAQ
How do I install the Animated Arrow with shadcn?
Run npx shadcn@latest add @tentui/animated-arrow after adding the @tentui
registry to components.json (installation guide), or run
npx shadcn@latest add https://tentui.com/r/animated-arrow.json without it. The
CLI copies animated-arrow.tsx into your project and installs lucide-react.
Why doesn't the arrow move when I hover the button?
Add group/animated-arrow to the parent link or button. The arrow listens for
hover and keyboard focus on that named Tailwind group, so a plain group class
doesn't trigger it.
Does the Animated Arrow need "use client" in the Next.js App Router?
No. It has no state, effects, or animation library: the slide is a Tailwind CSS transition, so it renders in React Server Components as well as client components.
Is the Animated Arrow accessible?
Yes, as long as the parent has a label. The arrow is decorative and marked
aria-hidden, so give the link or button visible text or an aria-label;
keyboard focus slides it the same way hover does, and it stays still when the
user prefers reduced motion.
How do I change the arrow's color or direction?
Pass Tailwind classes through className, its only prop. The icons use the
current text color, so a class such as text-primary recolors them and
rotate-180 points the arrow the other way; change duration-500 in the source
to retime the slide.
Is the Animated Arrow free to use?
Yes. The Animated Arrow is free and source-available: the shadcn CLI copies its source into your project, and you can use it in unlimited personal and client projects under the TentUI License. The license doesn't allow redistributing or reselling the component itself.
Related components
All buttons and toggles- Copy Button
Copy text to the clipboard with visual, sound, and haptic feedback.
- Glass Toggle
An on/off switch with a thumb of thick frosted glass. Flip it and the thumb springs across, a pixel moon scatters and reassembles as a pixel sun, and a rim light runs round the glass from cool lilac to warm amber.
- Hold to Confirm
Guard destructive actions behind a press-and-hold fill with rising sound, haptic ticks, and a checkmark.
- Peeping Button
Add a shy, cursor-tracking surprise behind a familiar button face.
Related guides
All guides- How to Add Animations to shadcn Components
Build accessible shadcn animations with source-owned code, shared-layout transitions, async feedback, and reduced-motion support.
- Best Animated shadcn/ui Components in 2026
A guide to TentUI's animated shadcn/ui components by job, from async buttons and pickers to charts, overlays, text effects, and AI thinking UI.