Animated React Components for shadcn/ui

Add motion to everyday React/shadcn UI components, including form controls, tabs, menus, and image cards.

shadcn animated is a React component library that provides 14+ animated interactions for your shadcn/ui project.

You get press feedback on buttons, drawn checkbox ticks, moving tab indicators, expanding panels, layered image cards, and more.

Features

  • Animated checkmarks, radio selection indicators, switch thumbs, and button press feedback.
  • Expanding accordions and collapsible panels with height and opacity transitions.
  • Moving tab indicators, hover-driven image layouts, and staggered floating-menu actions.
  • Base UI primitives for interactive controls, with Motion in components that need JavaScript animation.
  • Tailwind CSS styles and local TSX or JSX files installed through the shadcn-animated CLI.
  • Individual component installation, declared package dependencies, and overwrite-preview commands.

Use Cases

  • Account settings with animated selection states, tab changes, and collapsible preference groups.
  • Portfolio pages where overlapping image cards spread apart on hover.
  • Product dashboards with compact navigation buttons and expandable quick-action menus.

How To Use It

1. Initialize shadcn/ui

Initialize shadcn/ui in your Next.js/React project.

npx shadcn@latest init

2. Install the components you need

Run the component CLI from your project root. It installs external dependencies and writes local component files under the aliases.ui location in components.json (commonly components/ui/).

npx shadcn-animated add button checkbox tabs

3. Basic Usage: Add An Animated Button

// components/save-settings-button.tsx
import { Button } from "@/components/ui/button";
export function SaveSettingsButton() {
  return (
    <Button type="submit" variant="default">
      Save settings
    </Button>
  );
}

4. Advanced Example: Animated Settings Tabs

Install tabs before using this example. The line variant animates an underline beneath the active tab.

// components/account-settings-tabs.tsx
"use client";
import {
  Tabs,
  TabsContent,
  TabsList,
  TabsTrigger,
} from "@/components/ui/tabs";
export function AccountSettingsTabs() {
  return (
    <Tabs defaultValue="profile" className="w-full max-w-xl">
      <TabsList variant="line">
        <TabsTrigger value="profile">Profile</TabsTrigger>
        <TabsTrigger value="notifications">Notifications</TabsTrigger>
      </TabsList>
      <TabsContent value="profile">
        Update your profile details.
      </TabsContent>
      <TabsContent value="notifications">
        Choose the alerts you receive.
      </TabsContent>
    </Tabs>
  );
}

Available UI Components

ComponentDescription
AccordionExpanding panels animated by height and opacity.
ButtonPress-scale feedback, hover states, and style variants.
CheckboxCheckmark drawn when selected.
CollapsibleAnimated height, opacity, and vertical movement.
FAB MenuFloating action menu with staggered item transitions.
Hover ImageA fan of image previews inside a hover card.
Icon ToggleAnimated switch between two icons, with optional reset.
Image CardOverlapping front and back images that shift on hover.
Navigation ButtonForward or back arrow that moves on hover.
Radio GroupAnimated indicator for the selected radio input.
SelectBase UI select with styled trigger, popup, and items.
SheetDialog panel that slides in from any edge.
SwitchToggle thumb with a short stretch animation.
TabsAnimated active indicator with default and line styles.

Alternatives and Related Resources

sopo

sopo

Leave a Reply

Your email address will not be published. Required fields are marked *