Components
- Accordion
- Add to Cart
- Animated List
- Carousel
- Collapsible Sidebarnew
- Dynamic Island
- Expandable Cardnew
- Expanding Searchnew
- Filter Grid
- Kanban Board
- Layout Switcher
- Morphing Popover
- Number Flip
- Page Transition
- Product Gallery
- Segmented Control
- Sortable Table
- Stack Navigator
- Status Button
- Step Wizard
- Tabs
- Text Morphnew
- Theme Mode Switch
- Theme Morph Button
- Theme Toggle Button
- Theme Toggle Switch
- Theme Transition
- Toast Stacknew
Page Transition
PageTransition and navigateWithTransition: route changes animated by React's <ViewTransition>. Animate navigation with ready-made styles, installed with the shadcn CLI.
acme.studio/
Studio
We build interfaces that feel fast.
Design and engineering for teams who care about every frame.
FastEvery route ships under 50 kB.
ComposableBlocks that snap together.
TypedEnd-to-end type safety.
Installation
$ pnpm dlx shadcn@latest add @transition-kit/page-transitionSetup
"use client";
import { usePathname } from "next/navigation";
import type { ReactNode } from "react";
import { PageTransition } from "@/components/transitions/page-transition";
export const PageTransitions = ({ children }: { children: ReactNode }) => {
const pathname = usePathname();
return (
<PageTransition id={pathname} transition="slide" className="bg-background">
{children}
</PageTransition>
);
};import { PageTransitions } from "@/components/page-transitions";
import { SiteHeader } from "@/components/site-header";
export default function RootLayout({
children,
}: {
children: React.ReactNode;
}) {
return (
<html lang="en">
<body>
<SiteHeader />
<PageTransitions>{children}</PageTransitions>
</body>
</html>
);
}<Link href="/" transitionTypes={["page-back"]}>
Back
</Link>router.push("/", { transitionTypes: ["page-back"] });API Reference
PageTransition
| Prop | Type | Default | Description |
|---|---|---|---|
id | string | - | Identifies the current page, usually the pathname. The old page exits and the new one enters when it changes inside a Transition. |
transition | string | "fade" | Style slug. Fade ships with the core. |
duration | number | - | Milliseconds. Overrides the style's timing. |
easing | string | - | Overrides the style's easing. |
children | ReactNode | - | The routed content. |
...props | ComponentProps<"div"> | - | Spread onto the <div data-slot="page-transition"> that wraps each page and is snapshotted. |
navigateWithTransition
navigateWithTransition(navigate: () => void, options?: { direction?: "forward" | "back" }): void| Param | Type | Default | Description |
|---|---|---|---|
navigate | () => void | - | Anything updating the state id comes from: router.push, React Router's navigate, or setState. Runs inside startTransition. |
options.direction | "forward" | "back" | "forward" | "back" plays directional styles in reverse. |
PAGE_BACK_TYPE
| Field | Type | Description |
|---|---|---|
PAGE_BACK_TYPE | "page-back" | Pass it to your router's own transition types API instead of navigateWithTransition. |