Skip to content

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 init

Starting from scratch? Follow the framework setup instructions first.

Install Dialog

npx shadcn@latest add @smoothui/dialog

The 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.

profile-dialog.tsx
"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:

ComponentAnimation TypeUse Case
Typewriter TextCharacter revealHero sections, AI interfaces
Scramble HoverMatrix-style scrambleNavigation, headings
Wave TextWave motionDecorative headings
Reveal TextDirectional revealPage transitions

Interactive Cards

Cards with smooth expand, hover, and transition animations:

ComponentAnimation TypeUse Case
Expandable CardsLayout animationPortfolios, galleries
Glow Hover CardCursor-following glowFeature highlights
Scrollable Card StackParallax revealTestimonials, profiles

Button Animations

Buttons with satisfying micro-interactions:

ComponentAnimation TypeUse Case
Magnetic ButtonCursor attractionCTAs, navigation
Button CopySuccess feedbackCode snippets
Clip Corners ButtonCorner animationUnique CTAs

Form Inputs

Inputs with smooth focus and validation animations:

ComponentAnimation TypeUse Case
Animated InputFloating labelForms, search
Animated OTP InputDigit animationVerification flows

Notification Components

Animated feedback and notification elements:

ComponentAnimation TypeUse Case
Dynamic IslandExpand/collapseNotifications, status
ToastSlide animationAlerts, 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

Frequently asked questions

On this page