Production-ready animations, transitions, backgrounds, and scenes for Remotion
TypeScript ai-agentsclaude-codedemo-videomcpmcp-servermodel-context-protocolmotion-designproduct-demoreactremotionshadcnvideo
feat: redesign docs sidebar
dev_wandryc0bf6d558eea
diff --git a/app/docs/layout.tsx b/app/docs/layout.tsxindex fb52328b..96283f5d 100644--- a/app/docs/layout.tsx+++ b/app/docs/layout.tsx@@ -29,6 +29,11 @@ export default async function Layout({ children }: { children: ReactNode }) {// `navEnabled && jsx(slots.header)` guard in layouts/docs/client.nav={{ enabled: false }}searchToggle={{ enabled: false }}+ // Remove the sidebar hide/collapse button: fumadocs-ui 16.7 renders the+ // collapse trigger only under `collapsible && <SidebarCollapseTrigger>`+ // (slots/sidebar.js), so `collapsible: false` drops it (and the floating+ // re-expand trigger, since the rail can no longer collapse).+ sidebar={{ collapsible: false }}>{/* `relative isolate` scopes the decorative grid to the content column soit sits behind the page body but above the base background — the samediff --git a/app/globals.css b/app/globals.cssindex 839c5ae9..11d258d5 100644--- a/app/globals.css+++ b/app/globals.css@@ -230,8 +230,12 @@}/* Links (B4): foreground-weighted, underline reveals on hover via the- token border — accent color only on hover, never default-blue. */-.prose a {+ token border — accent color only on hover, never default-blue.+ Guarded with :not(:where([class~="not-prose"] *)) so the prose link+ treatment (notably the hover underline) does NOT leak into interactive+ .not-prose blocks like the component card grid. The :where() keeps the+ guard at zero specificity, so these stay equivalent to `.prose a`. */+.prose a:not(:where([class~="not-prose"] *)) {color: var(--foreground);font-weight: 500;text-decoration: none;@@ -239,11 +243,11 @@text-decoration-color: color-mix(in oklab, var(--foreground) 35%, transparent);transition: text-decoration-color 150ms ease, color 150ms ease;}-.prose a:hover {+.prose a:not(:where([class~="not-prose"] *)):hover {text-decoration: underline;text-decoration-color: color-mix(in oklab, var(--foreground) 60%, transparent);}-.prose a:focus-visible {+.prose a:not(:where([class~="not-prose"] *)):focus-visible {outline: none;border-radius: var(--radius-sm);box-shadow: 0 0 0 2px color-mix(in oklab, var(--ring) 60%, transparent);@@ -316,13 +320,15 @@color: var(--muted-foreground);}-/* Nav items: comfortable-compact rows (~34px), muted resting state.- Hover is a COLOR transition only — no background slab grow, no- underline animation (E6). We neutralise Fumadocs' hover:bg-*. */+/* Nav items: comfortable-compact rows (~34px), readable resting state.+ Items resolve to the foreground (white) token so the menu is legible;+ only the category headers stay subtle/muted for hierarchy. Hover is a+ COLOR transition only — no background slab grow, no underline animation+ (E6). We neutralise Fumadocs' hover:bg-*. */#nd-sidebar a[data-active],#nd-sidebar-mobile a[data-active] {padding-block: 0.375rem;- color: var(--muted-foreground);+ color: var(--foreground);transition: color 150ms ease;}#nd-sidebar a[data-active]:hover,diff --git a/components/docs/component-card-grid.tsx b/components/docs/component-card-grid.tsxindex 57beebdf..7d858131 100644--- a/components/docs/component-card-grid.tsx+++ b/components/docs/component-card-grid.tsx@@ -1,5 +1,4 @@-import Link from "next/link";-import { cn } from "@/lib/utils";+import { ComponentCard } from "./component-card";export interface CardItem {name: string;@@ -11,45 +10,9 @@ export interface CardItem {export function ComponentCardGrid({ items }: { items: CardItem[] }) {return (<div className="not-prose my-8 grid gap-3 sm:grid-cols-2 lg:grid-cols-3">- {items.map((item) => {- const card = (- <article- className={cn(- "surface-card group/card relative flex h-full flex-col gap-2 rounded-2xl p-5 transition-[transform,border-color]",- item.status === "stable"- ? "hover:-translate-y-0.5 hover:border-foreground/20"- : "opacity-60",- )}- >- <div className="flex items-center justify-between gap-2">- <h3 className="font-mono text-sm font-medium tracking-tight text-foreground">- {item.name}- </h3>- {item.status === "soon" && (- <span className="rounded bg-foreground/5 px-1.5 py-0.5 font-mono text-[10px] font-medium uppercase tracking-wider text-foreground/60">- Soon- </span>- )}- </div>- <p className="text-sm leading-relaxed text-muted-foreground">- {item.description}- </p>- </article>- );-- if (item.status === "stable" && item.href) {- return (- <Link- key={item.name}- href={item.href}- className="block rounded-2xl outline-none focus-visible:ring-2 focus-visible:ring-ring/40"- >- {card}- </Link>- );- }- return <div key={item.name}>{card}</div>;- })}+ {items.map((item) => (+ <ComponentCard key={item.name} item={item} />+ ))}</div>);}diff --git a/components/docs/component-card.tsx b/components/docs/component-card.tsxnew file mode 100644index 00000000..fcf3365d--- /dev/null+++ b/components/docs/component-card.tsx@@ -0,0 +1,142 @@+"use client";++import { Player, Thumbnail } from "@remotion/player";+import Link from "next/link";+import { type ReactNode, useEffect, useRef, useState } from "react";+import { getDefaults } from "@/lib/customizer-config";+import { usePrefersReducedMotion } from "@/lib/use-prefers-reduced-motion";+import { cn } from "@/lib/utils";+import registry from "@/registry/__index__";+import type { CardItem } from "./component-card-grid";++function slugFromHref(href?: string) {+ if (!href) return undefined;+ return href.split("/").filter(Boolean).pop();+}++/** Calm static surface shown when there is no live preview to render. */+function PreviewPlaceholder() {+ return <div className="size-full bg-muted/40" />;+}++/**+ * Preview area. The Remotion composition is only mounted once the card nears+ * the viewport (IntersectionObserver) — index pages render dozens of cards, so+ * eagerly mounting every Thumbnail would render dozens of compositions on load.+ * Until then, and for non-stable / unknown components, a calm placeholder shows.+ * In view + motion allowed: the live <Player> auto-plays (looping) — no hover+ * needed. Under prefers-reduced-motion it falls back to a static <Thumbnail>+ * first frame. Off-screen cards never mount a player.+ */+function CardPreview({ item }: { item: CardItem }) {+ const reducedMotion = usePrefersReducedMotion();+ const ref = useRef<HTMLDivElement>(null);+ const [inView, setInView] = useState(false);++ useEffect(() => {+ if (inView) return;+ const el = ref.current;+ if (!el || typeof IntersectionObserver === "undefined") return;+ const observer = new IntersectionObserver(+ (entries) => {+ if (entries.some((entry) => entry.isIntersecting)) {+ setInView(true);+ observer.disconnect();+ }+ },+ { rootMargin: "200px 0px" },+ );+ observer.observe(el);+ return () => observer.disconnect();+ }, [inView]);++ const slug = slugFromHref(item.href);+ const entry = slug ? registry[slug] : undefined;++ let content: ReactNode;+ if (item.status !== "stable" || !entry || !inView) {+ content = <PreviewPlaceholder />;+ } else {+ const { Component, config } = entry;+ const inputProps = getDefaults(config.controls);+ const playing = !reducedMotion;+ content = playing ? (+ <Player+ component={Component}+ inputProps={inputProps}+ durationInFrames={config.durationInFrames}+ fps={config.fps}+ compositionWidth={config.compositionWidth}+ compositionHeight={config.compositionHeight}+ style={{ width: "100%", height: "100%" }}+ controls={false}+ loop+ autoPlay+ acknowledgeRemotionLicense+ />+ ) : (+ <Thumbnail+ component={Component}+ inputProps={inputProps}+ durationInFrames={config.durationInFrames}+ fps={config.fps}+ compositionWidth={config.compositionWidth}+ compositionHeight={config.compositionHeight}+ frameToDisplay={0}+ style={{ width: "100%", height: "100%" }}+ acknowledgeRemotionLicense+ />+ );+ }++ return (+ <div ref={ref} className="size-full">+ {content}+ </div>+ );+}++function CardBody({ item }: { item: CardItem }) {+ return (+ <>+ <div className="surface-card aspect-video w-full overflow-hidden rounded-xl transition-[transform,border-color] group-hover/card:-translate-y-0.5 group-hover/card:border-foreground/20 group-focus-visible/card:-translate-y-0.5 group-focus-visible/card:border-foreground/20">+ <CardPreview item={item} />+ </div>+ <div className="flex items-center justify-between gap-2">+ <h3 className="text-sm font-medium tracking-tight text-foreground">+ {item.name}+ </h3>+ {item.status === "soon" && (+ <span className="rounded bg-foreground/5 px-1.5 py-0.5 text-[10px] font-medium uppercase tracking-wider text-foreground/60">+ Soon+ </span>+ )}+ </div>+ <p className="text-sm leading-relaxed text-muted-foreground">+ {item.description}+ </p>+ </>+ );+}++export function ComponentCard({ item }: { item: CardItem }) {+ if (item.status === "stable" && item.href) {+ return (+ <Link+ href={item.href}+ className={cn(+ "group/card flex h-full flex-col gap-2 rounded-2xl outline-none",+ "focus-visible:ring-2 focus-visible:ring-ring/40",+ )}+ >+ <CardBody item={item} />+ </Link>+ );+ }++ return (+ <div className="group/card flex h-full flex-col gap-2 rounded-2xl opacity-60">+ <CardBody item={item} />+ </div>+ );+}diff --git a/components/docs/component-preview.tsx b/components/docs/component-preview.tsxindex 1ef6506a..7da9c83a 100644--- a/components/docs/component-preview.tsx+++ b/components/docs/component-preview.tsx@@ -18,6 +18,7 @@ import {type ControlConfig,getDefaults,} from "@/lib/customizer-config";+import { usePrefersReducedMotion } from "@/lib/use-prefers-reduced-motion";import { cn } from "@/lib/utils";import registry from "@/registry/__index__";import { ComponentCustomizer } from "./component-customizer";@@ -211,19 +212,6 @@ function Preview({);}-function usePrefersReducedMotion() {- const [reduced, setReduced] = useState(false);- useEffect(() => {- if (typeof window === "undefined" || !window.matchMedia) return;- const mql = window.matchMedia("(prefers-reduced-motion: reduce)");- setReduced(mql.matches);- const onChange = (e: MediaQueryListEvent) => setReduced(e.matches);- mql.addEventListener("change", onChange);- return () => mql.removeEventListener("change", onChange);- }, []);- return reduced;-}-/*** D2 — lazy-mount the Remotion player. Until the stage enters the viewport* (IntersectionObserver) or the user clicks the poster, render a labeleddiff --git a/content/docs/compositions/meta.json b/content/docs/compositions/meta.jsonindex 2653c17e..61dcb651 100644--- a/content/docs/compositions/meta.json+++ b/content/docs/compositions/meta.json@@ -3,20 +3,16 @@"collapsible": false,"pages": ["index",- "---Hero & Outro---","hero-device-assemble","ecosystem-constellation","infinite-bento-pan",- "---Product Showcases---","browser-flow","ai-generation-canvas","live-code-compilation","terminal-to-browser-deploy",- "---App States & Journeys---","dashboard-populate","pipeline-journey","pricing-tier-focus",- "---Use Case Templates---","product-launch-trailer","changelog-bite","visual-docs-snippet"diff --git a/content/docs/environment/meta.json b/content/docs/environment/meta.jsonindex df01be01..eb1fa917 100644--- a/content/docs/environment/meta.json+++ b/content/docs/environment/meta.json@@ -3,10 +3,8 @@"collapsible": false,"pages": ["index",- "---Backgrounds---","mesh-gradient-bg","dynamic-grid",- "---Lighting---","spotlight-card"]}diff --git a/content/docs/primitives/meta.json b/content/docs/primitives/meta.jsonindex e733fa8a..be45311f 100644--- a/content/docs/primitives/meta.json+++ b/content/docs/primitives/meta.json@@ -3,11 +3,9 @@"collapsible": false,"pages": ["index",- "---Animations---","spring-pop-in","pulsing-indicator","success-confetti",- "---Interactions---","cursor-flow","brush-stroke-simulator","bounding-box-selector",diff --git a/content/docs/transitions/meta.json b/content/docs/transitions/meta.jsonindex da8962a9..44e74fdc 100644--- a/content/docs/transitions/meta.json+++ b/content/docs/transitions/meta.json@@ -3,17 +3,14 @@"collapsible": false,"pages": ["index",- "---Camera & Scale---","zoom-through-transition","device-mockup-zoom","morphing-modal","image-expand-to-fullscreen",- "---Spatial Wipes---","directional-wipe","swipe-transition-wipe","spatial-push","frosted-glass-wipe",- "---Stylized---","grid-pixelate-wipe","chromatic-aberration-wipe"]diff --git a/content/docs/typography/meta.json b/content/docs/typography/meta.jsonindex d433d1bf..f0e0fb8b 100644--- a/content/docs/typography/meta.json+++ b/content/docs/typography/meta.json@@ -3,23 +3,18 @@"collapsible": false,"pages": ["index",- "---Reveals---","blur-reveal","staggered-fade-up","masked-slide-reveal","tracking-in",- "---Highlights---","inline-highlight","marker-highlight","shimmer-sweep",- "---Dynamic Text---","typewriter","text-fade-replace","slot-machine-roll",- "---Hero & Display---","infinite-marquee","perspective-marquee",- "---Tech & Glitch---","matrix-decode","rgb-glitch-text"]diff --git a/content/docs/ui-blocks/meta.json b/content/docs/ui-blocks/meta.jsonindex 5f824f2f..dafbfefa 100644--- a/content/docs/ui-blocks/meta.json+++ b/content/docs/ui-blocks/meta.json@@ -3,21 +3,16 @@"collapsible": false,"pages": ["index",- "---Code & CLI---","glass-code-block","terminal-simulator","code-accordion","code-diff-wipe",- "---Layouts---","staggered-bento-grid","dynamic-split-screen",- "---Overlays & Panels---","ai-generate-overlay","tool-menu-slide-in",- "---Data & System---","animated-line-chart","animated-bar-chart",- "---Workflows---","drag-and-drop-flow"]}diff --git a/lib/use-prefers-reduced-motion.ts b/lib/use-prefers-reduced-motion.tsnew file mode 100644index 00000000..1b4e5afa--- /dev/null+++ b/lib/use-prefers-reduced-motion.ts@@ -0,0 +1,21 @@+"use client";++import { useEffect, useState } from "react";++/**+ * Tracks the user's `prefers-reduced-motion` setting. Returns `false` until+ * mounted (SSR-safe), then reflects the live media-query value. Shared by the+ * docs preview surfaces so motion can be gated consistently.+ */+export function usePrefersReducedMotion() {+ const [reduced, setReduced] = useState(false);+ useEffect(() => {+ if (typeof window === "undefined" || !window.matchMedia) return;+ const mql = window.matchMedia("(prefers-reduced-motion: reduce)");+ setReduced(mql.matches);+ const onChange = (e: MediaQueryListEvent) => setReduced(e.matches);+ mql.addEventListener("change", onChange);+ return () => mql.removeEventListener("change", onChange);+ }, []);+ return reduced;+}