How to Add Animated Components to React
Install an animated React dialog with the shadcn CLI, render it in your app, and test keyboard focus and reduced motion.
Last updated: December 3, 2026
Add an animated component to an existing React app without writing the animation yourself. Start with Dialog, a modal with a spring entrance, keyboard focus management, and reduced-motion support. Try the live Dialog and AlertDialog previews before installing.
Prepare your project
Use React 19 and Tailwind CSS 4. If your project already has a shadcn components.json, skip initialization. Otherwise, run this from your project root:
npx shadcn@latest initStarting from scratch? Follow the framework setup instructions first.
Install Dialog
npx shadcn@latest add @smoothui/dialogThe CLI adds the component source and its dependencies to your project. You can edit the installed source instead of wrapping a library component to change its styling or motion.
Render a dialog
Create a component that opens from a button. If your shadcn aliases differ, adjust the import to match the path printed by the CLI.
"use client";
import Dialog, { DialogClose } from "@/components/smoothui/dialog";
export default function ProfileDialog() {
return (
<Dialog
title="Workspace profile"
description="Your teammates can see this profile."
trigger={<button type="button">View profile</button>}
footer={<DialogClose>Done</DialogClose>}
>
<p>Design team member</p>
</Dialog>
);
}Import ProfileDialog into a page and render it. Open the dialog, cycle through its controls with Tab, then press Escape. Focus should return to View profile. With reduced motion enabled, reopen it to check that the modal shows without its spring entrance.
Animation Categories
Text Animations
Create engaging text effects that capture attention:
| Component | Animation Type | Use Case |
|---|---|---|
| Typewriter Text | Character reveal | Hero sections, AI interfaces |
| Scramble Hover | Matrix-style scramble | Navigation, headings |
| Wave Text | Wave motion | Decorative headings |
| Reveal Text | Directional reveal | Page transitions |
Interactive Cards
Cards with smooth expand, hover, and transition animations:
| Component | Animation Type | Use Case |
|---|---|---|
| Expandable Cards | Layout animation | Portfolios, galleries |
| Glow Hover Card | Cursor-following glow | Feature highlights |
| Scrollable Card Stack | Parallax reveal | Testimonials, profiles |
Button Animations
Buttons with satisfying micro-interactions:
| Component | Animation Type | Use Case |
|---|---|---|
| Magnetic Button | Cursor attraction | CTAs, navigation |
| Button Copy | Success feedback | Code snippets |
| Clip Corners Button | Corner animation | Unique CTAs |
Form Inputs
Inputs with smooth focus and validation animations:
| Component | Animation Type | Use Case |
|---|---|---|
| Animated Input | Floating label | Forms, search |
| Animated OTP Input | Digit animation | Verification flows |
Notification Components
Animated feedback and notification elements:
| Component | Animation Type | Use Case |
|---|---|---|
| Dynamic Island | Expand/collapse | Notifications, status |
| Toast | Slide animation | Alerts, confirmations |
Adjust the animation
Dialog uses Motion. Some other components use GSAP. Check the dependencies on the component page before editing its source. If you change a transition, test it again with reduced motion enabled.
Picking an engine first
SmoothUI gives you ready-made components, not an animation engine. If you want to build and control the animation yourself, compare React animation libraries first.
Explore more components
All Components
Explore the complete collection of 182 animated components.
Installation
Set up SmoothUI in your React or Next.js project.