UIPin
ComponentsIconsIllustrationsMotionTemplatesApps
Boards
UIPin

Free, open-source UI components, icons, illustrations, motion, templates and apps, in one search. Every item links to its source and licence.

UIPin is free. If it saved you time, you can keep it running:

Buy me a coffee
ComponentsIconsIllustrationsMotionTemplatesAppsLibrariesCompareNew this weekMCP for agentsBoardsPrivacy

Components, icons and artwork belong to their authors and are shown under their open-source licences.

Motion Primitives/Transition Panel

Other
1 of 2
Compiling

Theme it

Every preview, live

Brand colour

Corner radius

Font

Recolours shadcn’s tokens, Tailwind’s accent colours and colours set in the code. Red, amber and green classes stay, since they usually mean error, warning or success.

2 versions·2 libraries

  • Motion Primitives
  • Cult UI

Transition Panel

A panel component with smooth transitions between different states.

npx shadcn@latest add https://motion-primitives.com/c/transition-panel.json
Open in v0 Docs Repo
Library
Motion Primitives
License
MIT
Stack
React · Tailwind CSS · animated
Packages
motion
Size
49 lines
Demo
Written by UIPin: the library doesn’t ship a usage example, so the preview uses one of ours (in the code below).

Code

transition-panel.tsx

'use client';
import {
  AnimatePresence,
  Transition,
  Variant,
  motion,
  MotionProps,
} from 'motion/react';
import { cn } from '@/lib/utils';

export type TransitionPanelProps = {
  children: React.ReactNode[];
  className?: string;
  transition?: Transition;
  activeIndex: number;
  variants?: { enter: Variant; center: Variant; exit: Variant };
} & MotionProps;

export function TransitionPanel({
  children,
  className,
  transition,
  variants,
  activeIndex,
  ...motionProps
}: TransitionPanelProps) {
  return (
    <div className={cn('relative', className)}>
      <AnimatePresence
        initial={false}
        mode='popLayout'
        custom={motionProps.custom}
      >
        <motion.div
          key={activeIndex}
          variants={variants}
          transition={transition}
          initial='enter'
          animate='center'
          exit='exit'
          {...motionProps}
        >
          {children[activeIndex]}
        </motion.div>
      </AnimatePresence>
    </div>
  );
}

More like this

Label

HextaUI·Inputs & forms

Collapsible

HextaUI·Data display

Resizable

HextaUI·Data display

Bento Grid

Magic UI·Cards

Native select

HextaUI·Inputs & forms

Accordion

shadcn/ui·Data display

Logo Timeline

Eldora UI·Media & 3D

Intro Disclosure

Cult UI·Data display

Popover

Cult UI·Overlays

Floating Panel

Cult UI·Cursor & effects

Logo Cloud 4

SmoothUI·Media & 3D

Page Transition

Animate UI·NavigationMIT+

Kbd

HextaUI·Data display

Bg Image Texture

Cult UI·Text effects

Features 1

SmoothUI·Cards