Production-ready animations, transitions, backgrounds, and scenes for Remotion
TypeScript ai-agentsclaude-codedemo-videomcpmcp-servermodel-context-protocolmotion-designproduct-demoreactremotionshadcnvideo
{
"$schema": "https://ui.shadcn.com/schema/registry-item.json",
"name": "drawer",
"title": "UI Drawer",
"description": "A bottom panel whose opened/closed state is a pure function of the timeline; the backdrop dim and bottom-edge slide-up are keyframed presets, with a drag handle and a primary action. Self-contained — pair it with the Button as a trigger (see the example).",
"dependencies": ["remotion"],
"registryDependencies": ["@remocn/remocn-ui"],
"files": [
{
"path": "registry/remocn-ui/drawer/index.tsx",
"content": "\"use client\";\n\nimport { type RemocnTheme, useRemocnTheme } from \"@/lib/remocn-ui\";\n\nexport type DrawerState = \"opened\" | \"closed\";\n\nexport interface DrawerProps {\n state?: DrawerState;\n style?: DrawerStyle;\n title?: string;\n description?: string;\n actionLabel?: string;\n cancelLabel?: string;\n theme?: Partial<RemocnTheme>;\n className?: string;\n}\n\nconst DRAWER_HEIGHT = 320;\nconst MAX_OVERLAY_ALPHA = 0.5;\n\nexport interface DrawerStyle {\n overlayOpacity: number;\n panelOpacity: number;\n panelTranslateY: number;\n}\n\nexport interface DrawerStyleContext {\n popoverBg: string;\n popoverFg: string;\n mutedFg: string;\n border: string;\n radius: number;\n actionBg: string;\n actionFg: string;\n cancelFg: string;\n}\n\nexport function drawerStyleContext(theme: RemocnTheme): DrawerStyleContext {\n return {\n popoverBg: theme.popover,\n popoverFg: theme.popoverForeground,\n mutedFg: theme.mutedForeground,\n border: theme.border,\n radius: theme.radius,\n actionBg: theme.primary,\n actionFg: theme.primaryForeground,\n cancelFg: theme.foreground,\n };\n}\n\nexport function drawerStyle(\n state: DrawerState,\n _ctx: DrawerStyleContext,\n): DrawerStyle {\n switch (state) {\n case \"opened\":\n return {\n overlayOpacity: 1,\n panelOpacity: 1,\n panelTranslateY: 0,\n };\n default:\n return {\n overlayOpacity: 0,\n panelOpacity: 0,\n panelTranslateY: DRAWER_HEIGHT,\n };\n }\n}\n\nexport function Drawer({\n state = \"closed\",\n style,\n title = \"Edit profile\",\n description = \"Make changes to your profile here. Click save when you're done.\",\n actionLabel = \"Save changes\",\n cancelLabel = \"Cancel\",\n theme: themeOverride,\n className,\n}: DrawerProps) {\n const theme = useRemocnTheme(themeOverride, \"light\");\n\n const ctx = drawerStyleContext(theme);\n const v = style ?? drawerStyle(state, ctx);\n\n const buttonBase: React.CSSProperties = {\n height: 40,\n padding: \"0 20px\",\n fontSize: 15,\n fontWeight: 500,\n letterSpacing: \"-0.01em\",\n borderRadius: ctx.radius,\n display: \"inline-flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n cursor: \"pointer\",\n };\n\n return (\n <div\n style={{\n position: \"absolute\",\n inset: 0,\n fontFamily:\n \"var(--font-geist-sans), -apple-system, BlinkMacSystemFont, sans-serif\",\n }}\n >\n {}\n <div\n style={{\n position: \"absolute\",\n inset: 0,\n background: `rgba(0, 0, 0, ${MAX_OVERLAY_ALPHA * v.overlayOpacity})`,\n }}\n />\n {}\n <div\n className={className}\n style={{\n position: \"absolute\",\n left: 0,\n right: 0,\n bottom: 0,\n height: DRAWER_HEIGHT,\n transform: `translateY(${v.panelTranslateY}px)`,\n opacity: v.panelOpacity,\n background: ctx.popoverBg,\n color: ctx.popoverFg,\n borderTop: `1px solid ${ctx.border}`,\n borderTopLeftRadius: ctx.radius + 6,\n borderTopRightRadius: ctx.radius + 6,\n padding: 24,\n display: \"flex\",\n flexDirection: \"column\",\n alignItems: \"center\",\n gap: 8,\n boxShadow: \"0 -24px 48px -12px rgba(0,0,0,0.25)\",\n }}\n >\n {}\n <div\n style={{\n width: 40,\n height: 5,\n borderRadius: 999,\n background: ctx.border,\n marginBottom: 8,\n }}\n />\n {}\n <div\n style={{\n width: \"100%\",\n maxWidth: 440,\n display: \"flex\",\n flexDirection: \"column\",\n gap: 8,\n }}\n >\n <div\n style={{\n fontSize: 18,\n fontWeight: 500,\n letterSpacing: \"-0.01em\",\n }}\n >\n {title}\n </div>\n <div style={{ fontSize: 14, lineHeight: 1.5, color: ctx.mutedFg }}>\n {description}\n </div>\n <div\n style={{\n display: \"flex\",\n justifyContent: \"flex-end\",\n gap: 8,\n marginTop: 16,\n }}\n >\n {}\n <button\n type=\"button\"\n style={{\n ...buttonBase,\n background: \"transparent\",\n color: ctx.cancelFg,\n border: `1px solid ${ctx.border}`,\n }}\n >\n {cancelLabel}\n </button>\n {}\n <button\n type=\"button\"\n style={{\n ...buttonBase,\n background: ctx.actionBg,\n color: ctx.actionFg,\n border: \"1px solid transparent\",\n }}\n >\n {actionLabel}\n </button>\n </div>\n </div>\n </div>\n </div>\n );\n}\n",
"type": "registry:component",
"target": "components/remocn/drawer.tsx"
},
{
"path": "registry/remocn-ui/drawer/use-drawer-transition.ts",
"content": "\"use client\";\n\nimport {\n type DrawerState,\n type DrawerStyle,\n drawerStyle,\n drawerStyleContext,\n} from \"@/components/remocn/drawer\";\nimport {\n easings,\n type RemocnTheme,\n type Step,\n useRemocnTheme,\n useStateTransition,\n} from \"@/lib/remocn-ui\";\n\nexport const DEFAULT_DURATION = 12;\n\nexport function tweenDrawerStyle(\n a: DrawerStyle,\n b: DrawerStyle,\n t: number,\n): DrawerStyle {\n return {\n overlayOpacity:\n a.overlayOpacity + (b.overlayOpacity - a.overlayOpacity) * t,\n panelOpacity: a.panelOpacity + (b.panelOpacity - a.panelOpacity) * t,\n panelTranslateY:\n a.panelTranslateY + (b.panelTranslateY - a.panelTranslateY) * t,\n };\n}\n\nexport interface DrawerTransitionOptions {\n theme?: Partial<RemocnTheme>;\n mode?: \"light\" | \"dark\";\n speed?: number;\n defaultDuration?: number;\n}\n\nexport function useDrawerTransition(\n steps: Step<DrawerState>[],\n opts: DrawerTransitionOptions = {},\n): DrawerStyle {\n const {\n theme: themeOverride,\n mode,\n speed = 1,\n defaultDuration = DEFAULT_DURATION,\n } = opts;\n const theme = useRemocnTheme(themeOverride, mode);\n const ctx = drawerStyleContext(theme);\n const { from, to, progress } = useStateTransition(\n steps,\n \"closed\",\n speed,\n defaultDuration,\n );\n const t = easings.out(progress);\n return tweenDrawerStyle(drawerStyle(from, ctx), drawerStyle(to, ctx), t);\n}\n",
"type": "registry:component",
"target": "components/remocn/use-drawer-transition.ts"
}
],
"type": "registry:component"
}