Skip to content

Production-ready animations, transitions, backgrounds, and scenes for Remotion

feat: apply all theme config

dev_wandry22153493781a
diff --git a/components/docs/examples/accordion-example.tsx b/components/docs/examples/accordion-example.tsx
index 349ef4ba..3b5ffd42 100644
--- a/components/docs/examples/accordion-example.tsx
+++ b/components/docs/examples/accordion-example.tsx
@@ -15,10 +15,16 @@ export interface AccordionExampleProps {
}
export const AccordionExampleScene = (p: AccordionExampleProps = {}) => {
- const style = useAccordionTransition([
- { at: 18, state: "opened", duration: 16 },
- { at: 78, state: "closed", duration: 12 },
- ]);
+ // Forward honored color props into the hook so the interpolated card
+ // background tracks variant/mode — otherwise the baked light background wins
+ // (via `style` precedence) and dark mode leaves a white card.
+ const style = useAccordionTransition(
+ [
+ { at: 18, state: "opened", duration: 16 },
+ { at: 78, state: "closed", duration: 12 },
+ ],
+ { variant: p.variant, mode: p.mode },
+ );
return (
<Accordion
title={p.title ?? "Is it accessible?"}
@@ -51,6 +57,14 @@ export const accordionExampleCode = (
if (mode !== undefined && mode !== "light") props.push(`mode="${mode}"`);
const propsStr = props.length ? `\n ${props.join("\n ")}\n ` : "";
+
+ // variant/mode are also forwarded into the hook so the animated card bg tracks them.
+ const hookOpts: string[] = [];
+ if (variant !== undefined && variant !== "default")
+ hookOpts.push(`variant: "${variant}"`);
+ if (mode !== undefined && mode !== "light") hookOpts.push(`mode: "${mode}"`);
+ const optsStr = hookOpts.length ? `, { ${hookOpts.join(", ")} }` : "";
+
return `import { Accordion } from "@/components/remocn/accordion";
import { useAccordionTransition } from "@/components/remocn/use-accordion-transition";
@@ -58,7 +72,7 @@ export const Scene = () => {
const style = useAccordionTransition([
{ at: 18, state: "opened", duration: 16 },
{ at: 78, state: "closed", duration: 12 },
- ]);
+ ]${optsStr});
return (
<Accordion${propsStr === "" ? " " : propsStr}style={style} />
diff --git a/components/docs/examples/alert-dialog-example.tsx b/components/docs/examples/alert-dialog-example.tsx
index ced20cf9..736d61da 100644
--- a/components/docs/examples/alert-dialog-example.tsx
+++ b/components/docs/examples/alert-dialog-example.tsx
@@ -25,13 +25,16 @@ export const AlertDialogExampleScene = (p: AlertDialogExampleProps = {}) => {
{ at: 14, state: "hover" },
{ at: 26, state: "press" },
],
- { variant: "destructive" },
+ { variant: "destructive", mode: p.mode },
);
// The dialog opens right after the press, then closes near the end.
- const dialog = useAlertDialogTransition([
- { at: 32, state: "opened", duration: 16 },
- { at: 92, state: "closed", duration: 12 },
- ]);
+ const dialog = useAlertDialogTransition(
+ [
+ { at: 32, state: "opened", duration: 16 },
+ { at: 92, state: "closed", duration: 12 },
+ ],
+ { mode: p.mode },
+ );
return (
<>
<Button label="Delete account" variant="destructive" mode={p.mode ?? "light"} style={trigger} />
@@ -63,6 +66,9 @@ export const alertDialogExampleCode = (
if (cancelLabel !== undefined && cancelLabel !== "Cancel") alertDialogProps.push(`cancelLabel="${cancelLabel}"`);
if (mode !== undefined && mode !== "light") alertDialogProps.push(`mode="${mode}"`);
+ const modeOptStr = mode !== undefined && mode !== "light" ? `, mode: "${mode}"` : "";
+ const dialogOptsStr = mode !== undefined && mode !== "light" ? `, { mode: "${mode}" }` : "";
+
const buttonModeStr = mode !== undefined && mode !== "light" ? ` mode="${mode}"` : "";
const alertDialogPropsStr = alertDialogProps.length ? ` ${alertDialogProps.join(" ")}` : "";
@@ -77,12 +83,14 @@ export const Scene = () => {
{ at: 14, state: "hover" },
{ at: 26, state: "press" },
],
- { variant: "destructive" },
+ { variant: "destructive"${modeOptStr} },
+ );
+ const dialog = useAlertDialogTransition(
+ [
+ { at: 32, state: "opened", duration: 16 },
+ { at: 92, state: "closed", duration: 12 },
+ ]${dialogOptsStr},
);
- const dialog = useAlertDialogTransition([
- { at: 32, state: "opened", duration: 16 },
- { at: 92, state: "closed", duration: 12 },
- ]);
return (
<>
diff --git a/components/docs/examples/button-example.tsx b/components/docs/examples/button-example.tsx
index dbaf2cd5..b47eee9c 100644
--- a/components/docs/examples/button-example.tsx
+++ b/components/docs/examples/button-example.tsx
@@ -28,12 +28,19 @@ export interface ButtonExampleProps {
export const ButtonExampleScene = (p: ButtonExampleProps = {}) => {
// Timeline owns `state` via the interpolated style — never a flat prop.
- const style = useButtonTransition([
- { at: 12, state: "hover" },
- { at: 30, state: "press" },
- { at: 48, state: "loading", duration: 6 },
- { at: 96, state: "success", duration: 16 },
- ]);
+ // Forward the honored color props into the hook so the interpolated background
+ // tracks the current variant/mode/primary. Without this the style bakes the
+ // default-variant light background and `style` (which wins over the component's
+ // own variant/mode) makes those toggles no-ops on the button surface.
+ const style = useButtonTransition(
+ [
+ { at: 12, state: "hover" },
+ { at: 30, state: "press" },
+ { at: 48, state: "loading", duration: 6 },
+ { at: 96, state: "success", duration: 16 },
+ ],
+ { variant: p.variant, mode: p.mode, primary: p.primary },
+ );
return (
<Button
label={p.label ?? "Continue"}
@@ -74,6 +81,16 @@ export const buttonExampleCode = (
// overrides are appended before `style` so the timeline prop stays last.
const propsStr = props.length ? `${props.join(" ")} ` : "";
+ // Color-affecting props are ALSO forwarded into the transition hook so the
+ // animated background tracks them (size/label only need the component prop).
+ const hookOpts: string[] = [];
+ if (variant !== undefined && variant !== "default")
+ hookOpts.push(`variant: "${variant}"`);
+ if (mode !== undefined && mode !== "light") hookOpts.push(`mode: "${mode}"`);
+ if (primary !== undefined && primary !== "#171717")
+ hookOpts.push(`primary: "${primary}"`);
+ const optsStr = hookOpts.length ? `, { ${hookOpts.join(", ")} }` : "";
+
return `import { Button } from "@/components/remocn/button";
import { useButtonTransition } from "@/components/remocn/use-button-transition";
@@ -83,7 +100,7 @@ export const Scene = () => {
{ at: 30, state: "press" },
{ at: 48, state: "loading", duration: 6 },
{ at: 96, state: "success", duration: 16 },
- ]);
+ ]${optsStr});
return <Button ${propsStr}style={style} />;
};`;
diff --git a/components/docs/examples/checkbox-example.tsx b/components/docs/examples/checkbox-example.tsx
index 9cfc19e0..d048f069 100644
--- a/components/docs/examples/checkbox-example.tsx
+++ b/components/docs/examples/checkbox-example.tsx
@@ -16,7 +16,7 @@ export const CheckboxExampleScene = (p: CheckboxExampleProps = {}) => {
const style = useCheckboxTransition([
{ at: 18, state: "checked", duration: 14 },
{ at: 78, state: "unchecked", duration: 12 },
- ]);
+ ], { mode: p.mode, primary: p.primary });
return (
<Checkbox
label={p.label ?? "Accept terms and conditions"}
@@ -44,6 +44,12 @@ export const checkboxExampleCode = (
if (mode !== undefined && mode !== "light") props.push(`mode="${mode}"`);
const propsStr = props.length ? ` ${props.join(" ")}` : "";
+
+ const hookOpts: string[] = [];
+ if (mode !== undefined && mode !== "light") hookOpts.push(`mode: "${mode}"`);
+ if (primary !== undefined) hookOpts.push(`primary: "${primary}"`);
+ const optsStr = hookOpts.length ? `, { ${hookOpts.join(", ")} }` : "";
+
return `import { Checkbox } from "@/components/remocn/checkbox";
import { useCheckboxTransition } from "@/components/remocn/use-checkbox-transition";
@@ -51,7 +57,7 @@ export const Scene = () => {
const style = useCheckboxTransition([
{ at: 18, state: "checked", duration: 14 },
{ at: 78, state: "unchecked", duration: 12 },
- ]);
+ ]${optsStr});
return <Checkbox${propsStr} style={style} />;
};`;
diff --git a/components/docs/examples/combobox-example.tsx b/components/docs/examples/combobox-example.tsx
index 25134d81..03dd08f6 100644
--- a/components/docs/examples/combobox-example.tsx
+++ b/components/docs/examples/combobox-example.tsx
@@ -23,10 +23,13 @@ export const ComboboxExampleScene = (p: ComboboxExampleProps = {}) => {
const frame = useCurrentFrame();
// Panel: opens at frame 16, closes at frame 100.
- const panelStyle = useComboboxTransition([
- { at: 16, state: "opened", duration: 12 },
- { at: 100, state: "closed", duration: 12 },
- ]);
+ const panelStyle = useComboboxTransition(
+ [
+ { at: 16, state: "opened", duration: 12 },
+ { at: 100, state: "closed", duration: 12 },
+ ],
+ { mode: p.mode },
+ );
// Reveal "ba" character by character starting at frame 32.
const revealed = revealCount(
@@ -38,11 +41,14 @@ export const ComboboxExampleScene = (p: ComboboxExampleProps = {}) => {
// Animate the first row of the filtered list: idle → hover → press → selected.
// Once "ba" is fully revealed, only Banana remains; row 0 of the filtered list.
- const itemStyle = useSelectItemTransition([
- { at: 60, state: "hover", duration: 8 },
- { at: 72, state: "press", duration: 6 },
- { at: 80, state: "selected", duration: 8 },
- ]);
+ const itemStyle = useSelectItemTransition(
+ [
+ { at: 60, state: "hover", duration: 8 },
+ { at: 72, state: "press", duration: 6 },
+ { at: 80, state: "selected", duration: 8 },
+ ],
+ { mode: p.mode },
+ );
return (
<div style={{ position: "relative", width: "100%", height: "100%" }}>
@@ -70,6 +76,10 @@ export const comboboxExampleCode = (
if (mode !== undefined && mode !== "light") props.push(`mode="${mode}"`);
const extraProps = props.length ? `\n ${props.join("\n ")}` : "";
+ const hookOpts: string[] = [];
+ if (mode !== undefined && mode !== "light") hookOpts.push(`mode: "${mode}"`);
+ const optsStr = hookOpts.length ? `, { ${hookOpts.join(", ")} }` : "";
+
return `import { useCurrentFrame } from "remotion";
import { revealCount } from "@/lib/remocn-ui";
import { Combobox } from "@/components/remocn/combobox";
@@ -86,10 +96,12 @@ export const Scene = () => {
const frame = useCurrentFrame();
// Panel opens at frame 16, closes at frame 100.
- const panelStyle = useComboboxTransition([
- { at: 16, state: "opened", duration: 12 },
- { at: 100, state: "closed", duration: 12 },
- ]);
+ const panelStyle = useComboboxTransition(
+ [
+ { at: 16, state: "opened", duration: 12 },
+ { at: 100, state: "closed", duration: 12 },
+ ]${optsStr},
+ );
// revealCount drives how many characters of QUERY are visible.
const revealed = revealCount(
@@ -100,11 +112,13 @@ export const Scene = () => {
);
// Animate the first row of the filtered list once "ba" narrows it to Banana.
- const itemStyle = useSelectItemTransition([
- { at: 60, state: "hover", duration: 8 },
- { at: 72, state: "press", duration: 6 },
- { at: 80, state: "selected", duration: 8 },
- ]);
+ const itemStyle = useSelectItemTransition(
+ [
+ { at: 60, state: "hover", duration: 8 },
+ { at: 72, state: "press", duration: 6 },
+ { at: 80, state: "selected", duration: 8 },
+ ]${optsStr},
+ );
return (
<div style={{ position: "relative", width: "100%", height: "100%" }}>
diff --git a/components/docs/examples/command-menu-example.tsx b/components/docs/examples/command-menu-example.tsx
index cc662382..b7bbadbd 100644
--- a/components/docs/examples/command-menu-example.tsx
+++ b/components/docs/examples/command-menu-example.tsx
@@ -23,10 +23,13 @@ export const CommandMenuExampleScene = (p: CommandMenuExampleProps = {}) => {
const frame = useCurrentFrame();
// Panel: closed → opened at frame 16, then closed again at frame 108.
- const panelStyle = useCommandMenuTransition([
- { at: 16, state: "opened", duration: 16 },
- { at: 108, state: "closed", duration: 12 },
- ]);
+ const panelStyle = useCommandMenuTransition(
+ [
+ { at: 16, state: "opened", duration: 16 },
+ { at: 108, state: "closed", duration: 12 },
+ ],
+ { mode: p.mode },
+ );
// Reveal query characters from TYPE_START onward.
const revealed = revealCount(
@@ -38,11 +41,14 @@ export const CommandMenuExampleScene = (p: CommandMenuExampleProps = {}) => {
// The filtered list shrinks as more characters are revealed. We animate the
// first row of the filtered list (which becomes "Settings" once "set" is typed).
- const itemStyle = useCommandMenuItemTransition([
- { at: 84, state: "hover", duration: 8 },
- { at: 92, state: "press", duration: 6 },
- { at: 100, state: "selected", duration: 8 },
- ]);
+ const itemStyle = useCommandMenuItemTransition(
+ [
+ { at: 84, state: "hover", duration: 8 },
+ { at: 92, state: "press", duration: 6 },
+ { at: 100, state: "selected", duration: 8 },
+ ],
+ { mode: p.mode },
+ );
return (
<div style={{ position: "relative", width: "100%", height: "100%" }}>
@@ -66,6 +72,10 @@ export const commandMenuExampleCode = (
if (mode !== undefined && mode !== "light") props.push(`mode="${mode}"`);
const extraProps = props.length ? `\n ${props.join("\n ")}` : "";
+ const hookOpts: string[] = [];
+ if (mode !== undefined && mode !== "light") hookOpts.push(`mode: "${mode}"`);
+ const optsStr = hookOpts.length ? `, { ${hookOpts.join(", ")} }` : "";
+
return `import { useCurrentFrame } from "remotion";
import { revealCount } from "@/lib/remocn-ui";
import { CommandMenu } from "@/components/remocn/command-menu";
@@ -81,10 +91,12 @@ export const Scene = () => {
const frame = useCurrentFrame();
// Panel zooms in, holds while query is typed and a row is selected, then closes.
- const panelStyle = useCommandMenuTransition([
- { at: 16, state: "opened", duration: 16 },
- { at: 108, state: "closed", duration: 12 },
- ]);
+ const panelStyle = useCommandMenuTransition(
+ [
+ { at: 16, state: "opened", duration: 16 },
+ { at: 108, state: "closed", duration: 12 },
+ ]${optsStr},
+ );
// revealCount drives how many characters of QUERY are visible — the component
// filters the list as more characters appear.
@@ -96,11 +108,13 @@ export const Scene = () => {
);
// Animate the first row of the filtered list: idle → hover → press → selected.
- const itemStyle = useCommandMenuItemTransition([
- { at: 84, state: "hover", duration: 8 },
- { at: 92, state: "press", duration: 6 },
- { at: 100, state: "selected", duration: 8 },
- ]);
+ const itemStyle = useCommandMenuItemTransition(
+ [
+ { at: 84, state: "hover", duration: 8 },
+ { at: 92, state: "press", duration: 6 },
+ { at: 100, state: "selected", duration: 8 },
+ ]${optsStr},
+ );
return (
<div style={{ position: "relative", width: "100%", height: "100%" }}>
diff --git a/components/docs/examples/context-menu-example.tsx b/components/docs/examples/context-menu-example.tsx
index 6b98ff1e..e57bacdd 100644
--- a/components/docs/examples/context-menu-example.tsx
+++ b/components/docs/examples/context-menu-example.tsx
@@ -35,10 +35,13 @@ export const ContextMenuExampleScene = (p: ContextMenuExampleProps = {}) => {
]);
// Menu: opens just after the right-click, closes after the row interaction.
- const menuStyle = useContextMenuTransition([
- { at: 44, state: "opened", duration: 10 },
- { at: 92, state: "closed", duration: 10 },
- ]);
+ const menuStyle = useContextMenuTransition(
+ [
+ { at: 44, state: "opened", duration: 10 },
+ { at: 92, state: "closed", duration: 10 },
+ ],
+ { mode: p.mode },
+ );
// Row 1 ("Reload"): idle → hover → press → idle.
const rowState = useCurrentState(
@@ -49,7 +52,7 @@ export const ContextMenuExampleScene = (p: ContextMenuExampleProps = {}) => {
],
"idle",
);
- const rowStyle = useDropdownMenuItemTransition([{ at: 0, state: rowState }]);
+ const rowStyle = useDropdownMenuItemTransition([{ at: 0, state: rowState }], { mode: p.mode });
const items = p.items ?? ["Back", "Reload", "Save As…", "Inspect"];
@@ -121,6 +124,10 @@ export const contextMenuExampleCode = (
const extraProps = props.length ? `\n ${props.join("\n ")}` : "";
const modeStr = mode !== undefined && mode !== "light" ? ` mode="${mode}"` : "";
+ const hookOpts: string[] = [];
+ if (mode !== undefined && mode !== "light") hookOpts.push(`mode: "${mode}"`);
+ const optsStr = hookOpts.length ? `, { ${hookOpts.join(", ")} }` : "";
+
return `import { Cursor } from "@/components/remocn/cursor";
import { useCursorPath } from "@/components/remocn/use-cursor-path";
import { ContextMenu } from "@/components/remocn/context-menu";
@@ -147,10 +154,12 @@ export const Scene = () => {
]);
// Menu opens at the click point, closes after the row interaction.
- const menuStyle = useContextMenuTransition([
- { at: 44, state: "opened", duration: 10 },
- { at: 92, state: "closed", duration: 10 },
- ]);
+ const menuStyle = useContextMenuTransition(
+ [
+ { at: 44, state: "opened", duration: 10 },
+ { at: 92, state: "closed", duration: 10 },
+ ]${optsStr},
+ );
// Animate row 1 ("Reload"): idle → hover → press → idle.
const rowState = useCurrentState(
@@ -161,7 +170,7 @@ export const Scene = () => {
],
"idle",
);
- const rowStyle = useDropdownMenuItemTransition([{ at: 0, state: rowState }]);
+ const rowStyle = useDropdownMenuItemTransition([{ at: 0, state: rowState }]${optsStr});
return (
<div style={{ position: "relative", width: "100%", height: "100%" }}>
diff --git a/components/docs/examples/cursor-example.tsx b/components/docs/examples/cursor-example.tsx
index 75ee93ec..743e1637 100644
--- a/components/docs/examples/cursor-example.tsx
+++ b/components/docs/examples/cursor-example.tsx
@@ -9,10 +9,18 @@ const BTN_X = 620; // cursor tip target X (the pointer hotspot lands here)
const BTN_Y = 360; // cursor tip target Y
export interface CursorExampleProps {
+ variant?: "arrow" | "pointer";
+ size?: number;
+ rippleColor?: string;
mode?: "light" | "dark";
}
-export const cursorExampleControls = ["mode"] as const;
+export const cursorExampleControls = [
+ "variant",
+ "size",
+ "rippleColor",
+ "mode",
+] as const;
export const CursorExampleScene = (p: CursorExampleProps = {}) => {
const cursorStyle = useCursorPath([
@@ -21,12 +29,15 @@ export const CursorExampleScene = (p: CursorExampleProps = {}) => {
{ at: 72, x: BTN_X, y: BTN_Y, click: true, duration: 0 },
]);
- const buttonStyle = useButtonTransition([
- { at: 40, state: "hover", duration: 16 },
- { at: 68, state: "press", duration: 8 },
- { at: 76, state: "loading", duration: 6 },
- { at: 108, state: "success", duration: 16 },
- ]);
+ const buttonStyle = useButtonTransition(
+ [
+ { at: 40, state: "hover", duration: 16 },
+ { at: 68, state: "press", duration: 8 },
+ { at: 76, state: "loading", duration: 6 },
+ { at: 108, state: "success", duration: 16 },
+ ],
+ { mode: p.mode },
+ );
return (
<div style={{ position: "relative", width: "100%", height: "100%" }}>
@@ -40,7 +51,13 @@ export const CursorExampleScene = (p: CursorExampleProps = {}) => {
>
<Button label="Continue" style={buttonStyle} mode={p.mode ?? "light"} />
</div>
- <Cursor style={cursorStyle} variant="pointer" mode={p.mode ?? "light"} />
+ <Cursor
+ style={cursorStyle}
+ variant={p.variant ?? "arrow"}
+ size={p.size ?? 28}
+ rippleColor={p.rippleColor}
+ mode={p.mode ?? "light"}
+ />
</div>
);
};
@@ -48,10 +65,27 @@ export const CursorExampleScene = (p: CursorExampleProps = {}) => {
export const cursorExampleCode = (
values: Record<string, unknown> = {},
): string => {
+ const variant = values.variant as string | undefined;
+ const size = values.size as number | undefined;
+ const rippleColor = values.rippleColor as string | undefined;
const mode = values.mode as string | undefined;
+ // Button trigger keeps just `mode`; the <Cursor> shows the full honored set.
const modeStr = mode !== undefined && mode !== "light" ? ` mode="${mode}"` : "";
+ const cursorProps: string[] = [];
+ if (variant !== undefined && variant !== "arrow")
+ cursorProps.push(`variant="${variant}"`);
+ if (size !== undefined && size !== 28) cursorProps.push(`size={${size}}`);
+ if (rippleColor !== undefined && rippleColor !== "#171717")
+ cursorProps.push(`rippleColor="${rippleColor}"`);
+ if (mode !== undefined && mode !== "light") cursorProps.push(`mode="${mode}"`);
+ const cursorPropsStr = cursorProps.length ? ` ${cursorProps.join(" ")}` : "";
+
+ const hookOpts: string[] = [];
+ if (mode !== undefined && mode !== "light") hookOpts.push(`mode: "${mode}"`);
+ const optsStr = hookOpts.length ? `, { ${hookOpts.join(", ")} }` : "";
+
return `import { Cursor } from "@/components/remocn/cursor";
import { useCursorPath } from "@/components/remocn/use-cursor-path";
import { Button } from "@/components/remocn/button";
@@ -75,7 +109,7 @@ export const Scene = () => {
{ at: 68, state: "press", duration: 8 },
{ at: 76, state: "loading", duration: 6 },
{ at: 108, state: "success", duration: 16 },
- ]);
+ ]${optsStr});
return (
<div style={{ position: "relative", width: "100%", height: "100%" }}>
@@ -89,7 +123,7 @@ export const Scene = () => {
>
<Button label="Continue" style={buttonStyle}${modeStr} />
</div>
- <Cursor style={cursorStyle} variant="pointer"${modeStr} />
+ <Cursor style={cursorStyle}${cursorPropsStr} />
</div>
);
};`;
diff --git a/components/docs/examples/dialog-example.tsx b/components/docs/examples/dialog-example.tsx
index c648db2c..84d48217 100644
--- a/components/docs/examples/dialog-example.tsx
+++ b/components/docs/examples/dialog-example.tsx
@@ -20,15 +20,21 @@ export interface DialogExampleProps {
export const DialogExampleScene = (p: DialogExampleProps = {}) => {
// The trigger Button: idle → hover → press, the press lands just before the
// dialog opens (the "click" that triggers it).
- const trigger = useButtonTransition([
- { at: 14, state: "hover" },
- { at: 26, state: "press" },
- ]);
+ const trigger = useButtonTransition(
+ [
+ { at: 14, state: "hover" },
+ { at: 26, state: "press" },
+ ],
+ { mode: p.mode },
+ );
// The dialog opens right after the press, then closes near the end.
- const dialog = useDialogTransition([
- { at: 32, state: "opened", duration: 16 },
- { at: 92, state: "closed", duration: 12 },
- ]);
+ const dialog = useDialogTransition(
+ [
+ { at: 32, state: "opened", duration: 16 },
+ { at: 92, state: "closed", duration: 12 },
+ ],
+ { mode: p.mode },
+ );
return (
<>
<Button label="Edit profile" mode={p.mode ?? "light"} style={trigger} />
@@ -60,6 +66,10 @@ export const dialogExampleCode = (
if (cancelLabel !== undefined && cancelLabel !== "Cancel") dialogProps.push(`cancelLabel="${cancelLabel}"`);
if (mode !== undefined && mode !== "light") dialogProps.push(`mode="${mode}"`);
+ const hookOpts: string[] = [];
+ if (mode !== undefined && mode !== "light") hookOpts.push(`mode: "${mode}"`);
+ const optsStr = hookOpts.length ? `, { ${hookOpts.join(", ")} }` : "";
+
const buttonModeStr = mode !== undefined && mode !== "light" ? ` mode="${mode}"` : "";
const dialogPropsStr = dialogProps.length ? ` ${dialogProps.join(" ")}` : "";
@@ -69,14 +79,18 @@ import { Button } from "@/components/remocn/button";
import { useButtonTransition } from "@/components/remocn/use-button-transition";
export const Scene = () => {
- const trigger = useButtonTransition([
- { at: 14, state: "hover" },
- { at: 26, state: "press" },
- ]);
- const dialog = useDialogTransition([
- { at: 32, state: "opened", duration: 16 },
- { at: 92, state: "closed", duration: 12 },
- ]);
+ const trigger = useButtonTransition(
+ [
+ { at: 14, state: "hover" },
+ { at: 26, state: "press" },
+ ]${optsStr},
+ );
+ const dialog = useDialogTransition(
+ [
+ { at: 32, state: "opened", duration: 16 },
+ { at: 92, state: "closed", duration: 12 },
+ ]${optsStr},
+ );
return (
<>
diff --git a/components/docs/examples/drawer-example.tsx b/components/docs/examples/drawer-example.tsx
index ac130fe1..c71bdcdb 100644
--- a/components/docs/examples/drawer-example.tsx
+++ b/components/docs/examples/drawer-example.tsx
@@ -20,15 +20,21 @@ export interface DrawerExampleProps {
export const DrawerExampleScene = (p: DrawerExampleProps = {}) => {
// The trigger Button: idle → hover → press, the press lands just before the
// drawer opens (the "click" that triggers it).
- const trigger = useButtonTransition([
- { at: 14, state: "hover" },
- { at: 26, state: "press" },
- ]);
+ const trigger = useButtonTransition(
+ [
+ { at: 14, state: "hover" },
+ { at: 26, state: "press" },
+ ],
+ { mode: p.mode },
+ );
// The drawer slides up right after the press, then closes near the end.
- const drawer = useDrawerTransition([
- { at: 32, state: "opened", duration: 16 },
- { at: 92, state: "closed", duration: 12 },
- ]);
+ const drawer = useDrawerTransition(
+ [
+ { at: 32, state: "opened", duration: 16 },
+ { at: 92, state: "closed", duration: 12 },
+ ],
+ { mode: p.mode },
+ );
return (
<>
<Button label="Edit profile" mode={p.mode ?? "light"} style={trigger} />
@@ -60,6 +66,10 @@ export const drawerExampleCode = (
if (cancelLabel !== undefined && cancelLabel !== "Cancel") drawerProps.push(`cancelLabel="${cancelLabel}"`);
if (mode !== undefined && mode !== "light") drawerProps.push(`mode="${mode}"`);
+ const hookOpts: string[] = [];
+ if (mode !== undefined && mode !== "light") hookOpts.push(`mode: "${mode}"`);
+ const optsStr = hookOpts.length ? `, { ${hookOpts.join(", ")} }` : "";
+
const buttonModeStr = mode !== undefined && mode !== "light" ? ` mode="${mode}"` : "";
const drawerPropsStr = drawerProps.length ? ` ${drawerProps.join(" ")}` : "";
@@ -69,14 +79,18 @@ import { Button } from "@/components/remocn/button";
import { useButtonTransition } from "@/components/remocn/use-button-transition";
export const Scene = () => {
- const trigger = useButtonTransition([
- { at: 14, state: "hover" },
- { at: 26, state: "press" },
- ]);
- const drawer = useDrawerTransition([
- { at: 32, state: "opened", duration: 16 },
- { at: 92, state: "closed", duration: 12 },
- ]);
+ const trigger = useButtonTransition(
+ [
+ { at: 14, state: "hover" },
+ { at: 26, state: "press" },
+ ]${optsStr},
+ );
+ const drawer = useDrawerTransition(
+ [
+ { at: 32, state: "opened", duration: 16 },
+ { at: 92, state: "closed", duration: 12 },
+ ]${optsStr},
+ );
return (
<>
diff --git a/components/docs/examples/dropdown-menu-example.tsx b/components/docs/examples/dropdown-menu-example.tsx
index f79ce8a7..2cfb8e2b 100644
--- a/components/docs/examples/dropdown-menu-example.tsx
+++ b/components/docs/examples/dropdown-menu-example.tsx
@@ -21,13 +21,16 @@ export const DropdownMenuExampleScene = (p: DropdownMenuExampleProps = {}) => {
{ at: 14, state: "hover" },
{ at: 26, state: "press" },
],
- { variant: "outline" },
+ { variant: "outline", mode: p.mode },
);
// The menu opens just after the "click", then closes near the end.
- const menu = useDropdownMenuTransition([
- { at: 32, state: "opened", duration: 16 },
- { at: 96, state: "closed", duration: 12 },
- ]);
+ const menu = useDropdownMenuTransition(
+ [
+ { at: 32, state: "opened", duration: 16 },
+ { at: 96, state: "closed", duration: 12 },
+ ],
+ { mode: p.mode },
+ );
// One row walks hover → press while the panel is open (no persistent
// selection — a menu commits the action and dismisses).
const rowState = useCurrentState(
@@ -38,7 +41,7 @@ export const DropdownMenuExampleScene = (p: DropdownMenuExampleProps = {}) => {
],
"idle",
);
- const row = useDropdownMenuItemTransition([{ at: 0, state: rowState }]);
+ const row = useDropdownMenuItemTransition([{ at: 0, state: rowState }], { mode: p.mode });
return (
<DropdownMenu
style={menu}
@@ -61,6 +64,13 @@ export const dropdownMenuExampleCode = (
if (mode !== undefined && mode !== "light") props.push(`mode="${mode}"`);
const extraProps = props.length ? `\n ${props.join("\n ")}` : "";
+ const hookOpts: string[] = [];
+ if (mode !== undefined && mode !== "light") hookOpts.push(`mode: "${mode}"`);
+ const optsStr = hookOpts.length ? `, { ${hookOpts.join(", ")} }` : "";
+ const triggerOptsStr = hookOpts.length
+ ? `, { variant: "outline", ${hookOpts.join(", ")} }`
+ : `, { variant: "outline" }`;
+
return `import { DropdownMenu } from "@/components/remocn/dropdown-menu";
import { useDropdownMenuTransition } from "@/components/remocn/use-dropdown-menu-transition";
import { useDropdownMenuItemTransition } from "@/components/remocn/use-dropdown-menu-item-transition";
@@ -72,13 +82,14 @@ export const Scene = () => {
[
{ at: 14, state: "hover" },
{ at: 26, state: "press" },
- ],
- { variant: "outline" },
+ ]${triggerOptsStr},
+ );
+ const menu = useDropdownMenuTransition(
+ [
+ { at: 32, state: "opened", duration: 16 },
+ { at: 96, state: "closed", duration: 12 },
+ ]${optsStr},
);
- const menu = useDropdownMenuTransition([
- { at: 32, state: "opened", duration: 16 },
- { at: 96, state: "closed", duration: 12 },
- ]);
const rowState = useCurrentState(
[
{ at: 52, state: "hover" },
@@ -87,7 +98,7 @@ export const Scene = () => {
],
"idle",
);
- const row = useDropdownMenuItemTransition([{ at: 0, state: rowState }]);
+ const row = useDropdownMenuItemTransition([{ at: 0, state: rowState }]${optsStr});
return (
<DropdownMenu${extraProps}
diff --git a/components/docs/examples/input-example.tsx b/components/docs/examples/input-example.tsx
index 9dac8d4a..fe9109ef 100644
--- a/components/docs/examples/input-example.tsx
+++ b/components/docs/examples/input-example.tsx
@@ -21,7 +21,7 @@ export const InputExampleScene = (p: InputExampleProps = {}) => {
{ at: 24, state: "active", duration: 10 },
{ at: 40, state: "typing", duration: 22 },
{ at: 78, state: "invalid", duration: 12 },
- ]);
+ ], { mode: p.mode, primary: p.primary });
return (
<Input
placeholder={p.placeholder ?? "[email protected]"}
@@ -53,6 +53,12 @@ export const inputExampleCode = (
if (mode !== undefined && mode !== "light") props.push(`mode="${mode}"`);
const propsStr = props.length ? `\n ${props.join("\n ")}\n ` : "";
+
+ const hookOpts: string[] = [];
+ if (mode !== undefined && mode !== "light") hookOpts.push(`mode: "${mode}"`);
+ if (primary !== undefined) hookOpts.push(`primary: "${primary}"`);
+ const optsStr = hookOpts.length ? `, { ${hookOpts.join(", ")} }` : "";
+
return `import { Input } from "@/components/remocn/input";
import { useInputTransition } from "@/components/remocn/use-input-transition";
@@ -62,7 +68,7 @@ export const Scene = () => {
{ at: 24, state: "active", duration: 10 },
{ at: 40, state: "typing", duration: 22 },
{ at: 78, state: "invalid", duration: 12 },
- ]);
+ ]${optsStr});
return (
<Input${propsStr === "" ? " " : propsStr}style={style} />
diff --git a/components/docs/examples/popover-example.tsx b/components/docs/examples/popover-example.tsx
index b11e13db..8b06cebf 100644
--- a/components/docs/examples/popover-example.tsx
+++ b/components/docs/examples/popover-example.tsx
@@ -26,10 +26,13 @@ export const PopoverExampleScene = (p: PopoverExampleProps = {}) => {
]);
// Hover-card popover: opens shortly after the cursor arrives, closes as it leaves.
- const popoverStyle = usePopoverTransition([
- { at: 36, state: "opened", duration: 10 },
- { at: 100, state: "closed", duration: 10 },
- ]);
+ const popoverStyle = usePopoverTransition(
+ [
+ { at: 36, state: "opened", duration: 10 },
+ { at: 100, state: "closed", duration: 10 },
+ ],
+ { mode: p.mode },
+ );
return (
<div style={{ position: "relative", width: "100%", height: "100%" }}>
@@ -137,6 +140,10 @@ export const popoverExampleCode = (
): string => {
const mode = values.mode as string | undefined;
+ const hookOpts: string[] = [];
+ if (mode !== undefined && mode !== "light") hookOpts.push(`mode: "${mode}"`);
+ const optsStr = hookOpts.length ? `, { ${hookOpts.join(", ")} }` : "";
+
const modeStr =
mode !== undefined && mode !== "light" ? ` mode="${mode}"` : "";
@@ -157,10 +164,12 @@ export const Scene = () => {
]);
// Hover-card opens shortly after the cursor arrives, closes as it leaves.
- const popoverStyle = usePopoverTransition([
- { at: 36, state: "opened", duration: 10 },
- { at: 100, state: "closed", duration: 10 },
- ]);
+ const popoverStyle = usePopoverTransition(
+ [
+ { at: 36, state: "opened", duration: 10 },
+ { at: 100, state: "closed", duration: 10 },
+ ]${optsStr},
+ );
return (
<div style={{ position: "relative", width: "100%", height: "100%" }}>
diff --git a/components/docs/examples/radio-example.tsx b/components/docs/examples/radio-example.tsx
index 9952ac58..2e908c11 100644
--- a/components/docs/examples/radio-example.tsx
+++ b/components/docs/examples/radio-example.tsx
@@ -16,7 +16,7 @@ export const RadioExampleScene = (p: RadioExampleProps = {}) => {
const style = useRadioTransition([
{ at: 18, state: "checked", duration: 14 },
{ at: 78, state: "unchecked", duration: 12 },
- ]);
+ ], { mode: p.mode, primary: p.primary });
return (
<Radio
label={p.label ?? "Subscribe to updates"}
@@ -44,6 +44,12 @@ export const radioExampleCode = (
if (mode !== undefined && mode !== "light") props.push(`mode="${mode}"`);
const propsStr = props.length ? ` ${props.join(" ")}` : "";
+
+ const hookOpts: string[] = [];
+ if (mode !== undefined && mode !== "light") hookOpts.push(`mode: "${mode}"`);
+ if (primary !== undefined) hookOpts.push(`primary: "${primary}"`);
+ const optsStr = hookOpts.length ? `, { ${hookOpts.join(", ")} }` : "";
+
return `import { Radio } from "@/components/remocn/radio";
import { useRadioTransition } from "@/components/remocn/use-radio-transition";
@@ -51,7 +57,7 @@ export const Scene = () => {
const style = useRadioTransition([
{ at: 18, state: "checked", duration: 14 },
{ at: 78, state: "unchecked", duration: 12 },
- ]);
+ ]${optsStr});
return <Radio${propsStr} style={style} />;
};`;
diff --git a/components/docs/examples/select-example.tsx b/components/docs/examples/select-example.tsx
index 3ea85ffc..9d020a9e 100644
--- a/components/docs/examples/select-example.tsx
+++ b/components/docs/examples/select-example.tsx
@@ -20,19 +20,25 @@ export const SelectExampleScene = (p: SelectExampleProps = {}) => {
{ at: 14, state: "hover" },
{ at: 26, state: "press" },
],
- { variant: "outline" },
+ { variant: "outline", mode: p.mode },
);
// The panel reveals right after the press, then collapses near the end.
- const panel = useSelectTransition([
- { at: 32, state: "opened", duration: 16 },
- { at: 96, state: "closed", duration: 12 },
- ]);
+ const panel = useSelectTransition(
+ [
+ { at: 32, state: "opened", duration: 16 },
+ { at: 96, state: "closed", duration: 12 },
+ ],
+ { mode: p.mode },
+ );
// One row (index 1) is highlighted, pressed, then committed as selected.
- const row = useSelectItemTransition([
- { at: 52, state: "hover" },
- { at: 64, state: "press" },
- { at: 72, state: "selected", duration: 10 },
- ]);
+ const row = useSelectItemTransition(
+ [
+ { at: 52, state: "hover" },
+ { at: 64, state: "press" },
+ { at: 72, state: "selected", duration: 10 },
+ ],
+ { mode: p.mode },
+ );
return (
<Select
style={panel}
@@ -56,6 +62,13 @@ export const selectExampleCode = (
if (mode !== undefined && mode !== "light") props.push(`mode="${mode}"`);
const extraProps = props.length ? `\n ${props.join("\n ")}` : "";
+ const hookOpts: string[] = [];
+ if (mode !== undefined && mode !== "light") hookOpts.push(`mode: "${mode}"`);
+ const optsStr = hookOpts.length ? `, { ${hookOpts.join(", ")} }` : "";
+ const triggerOptsStr = hookOpts.length
+ ? `, { variant: "outline", ${hookOpts.join(", ")} }`
+ : `, { variant: "outline" }`;
+
return `import { useButtonTransition } from "@/components/remocn/use-button-transition";
import { Select } from "@/components/remocn/select";
import { useSelectTransition } from "@/components/remocn/use-select-transition";
@@ -66,18 +79,21 @@ export const Scene = () => {
[
{ at: 14, state: "hover" },
{ at: 26, state: "press" },
- ],
- { variant: "outline" },
+ ]${triggerOptsStr},
+ );
+ const panel = useSelectTransition(
+ [
+ { at: 32, state: "opened", duration: 16 },
+ { at: 96, state: "closed", duration: 12 },
+ ]${optsStr},
+ );
+ const row = useSelectItemTransition(
+ [
+ { at: 52, state: "hover" },
+ { at: 64, state: "press" },
+ { at: 72, state: "selected", duration: 10 },
+ ]${optsStr},
);
- const panel = useSelectTransition([
- { at: 32, state: "opened", duration: 16 },
- { at: 96, state: "closed", duration: 12 },
- ]);
- const row = useSelectItemTransition([
- { at: 52, state: "hover" },
- { at: 64, state: "press" },
- { at: 72, state: "selected", duration: 10 },
- ]);
return (
<Select${extraProps}
diff --git a/components/docs/examples/sheet-example.tsx b/components/docs/examples/sheet-example.tsx
index 4abe137e..193a3640 100644
--- a/components/docs/examples/sheet-example.tsx
+++ b/components/docs/examples/sheet-example.tsx
@@ -20,15 +20,21 @@ export interface SheetExampleProps {
export const SheetExampleScene = (p: SheetExampleProps = {}) => {
// The trigger Button: idle → hover → press, the press lands just before the
// sheet opens (the "click" that triggers it).
- const trigger = useButtonTransition([
- { at: 14, state: "hover" },
- { at: 26, state: "press" },
- ]);
+ const trigger = useButtonTransition(
+ [
+ { at: 14, state: "hover" },
+ { at: 26, state: "press" },
+ ],
+ { mode: p.mode },
+ );
// The sheet slides in right after the press, then closes near the end.
- const sheet = useSheetTransition([
- { at: 32, state: "opened", duration: 16 },
- { at: 92, state: "closed", duration: 12 },
- ]);
+ const sheet = useSheetTransition(
+ [
+ { at: 32, state: "opened", duration: 16 },
+ { at: 92, state: "closed", duration: 12 },
+ ],
+ { mode: p.mode },
+ );
return (
<>
<Button label="Edit profile" mode={p.mode ?? "light"} style={trigger} />
@@ -60,6 +66,10 @@ export const sheetExampleCode = (
if (cancelLabel !== undefined && cancelLabel !== "Cancel") sheetProps.push(`cancelLabel="${cancelLabel}"`);
if (mode !== undefined && mode !== "light") sheetProps.push(`mode="${mode}"`);
+ const hookOpts: string[] = [];
+ if (mode !== undefined && mode !== "light") hookOpts.push(`mode: "${mode}"`);
+ const optsStr = hookOpts.length ? `, { ${hookOpts.join(", ")} }` : "";
+
const buttonModeStr = mode !== undefined && mode !== "light" ? ` mode="${mode}"` : "";
const sheetPropsStr = sheetProps.length ? ` ${sheetProps.join(" ")}` : "";
@@ -69,14 +79,18 @@ import { Button } from "@/components/remocn/button";
import { useButtonTransition } from "@/components/remocn/use-button-transition";
export const Scene = () => {
- const trigger = useButtonTransition([
- { at: 14, state: "hover" },
- { at: 26, state: "press" },
- ]);
- const sheet = useSheetTransition([
- { at: 32, state: "opened", duration: 16 },
- { at: 92, state: "closed", duration: 12 },
- ]);
+ const trigger = useButtonTransition(
+ [
+ { at: 14, state: "hover" },
+ { at: 26, state: "press" },
+ ]${optsStr},
+ );
+ const sheet = useSheetTransition(
+ [
+ { at: 32, state: "opened", duration: 16 },
+ { at: 92, state: "closed", duration: 12 },
+ ]${optsStr},
+ );
return (
<>
diff --git a/components/docs/examples/skeleton-example.tsx b/components/docs/examples/skeleton-example.tsx
index 711f3a73..0d1f1856 100644
--- a/components/docs/examples/skeleton-example.tsx
+++ b/components/docs/examples/skeleton-example.tsx
@@ -14,9 +14,10 @@ export const skeletonExampleControls = ["layout", "mode"] as const;
export const SkeletonExampleScene = (p: SkeletonExampleProps = {}) => {
// Shimmer for ~3 full sweep cycles (180 frames) as if waiting on data, then
// crossfade to real content.
- const skeletonStyle = useSkeletonTransition([
- { at: 180, state: "loaded", duration: 16 },
- ]);
+ const skeletonStyle = useSkeletonTransition(
+ [{ at: 180, state: "loaded", duration: 16 }],
+ { mode: p.mode },
+ );
return (
<div
@@ -79,6 +80,10 @@ export const skeletonExampleCode = (
if (mode !== undefined && mode !== "light") props.push(`mode="${mode}"`);
const extraProps = props.length ? `\n ${props.join("\n ")}\n ` : "";
+ const hookOpts: string[] = [];
+ if (mode !== undefined && mode !== "light") hookOpts.push(`mode: "${mode}"`);
+ const optsStr = hookOpts.length ? `, { ${hookOpts.join(", ")} }` : "";
+
return `import { Skeleton } from "@/components/remocn/skeleton";
import { useSkeletonTransition } from "@/components/remocn/use-skeleton-transition";
@@ -87,7 +92,7 @@ export const Scene = () => {
// crossfade to real content.
const skeletonStyle = useSkeletonTransition([
{ at: 180, state: "loaded", duration: 16 },
- ]);
+ ]${optsStr});
return (
<div
diff --git a/components/docs/examples/switch-example.tsx b/components/docs/examples/switch-example.tsx
index e0a6ede6..f43eaa37 100644
--- a/components/docs/examples/switch-example.tsx
+++ b/components/docs/examples/switch-example.tsx
@@ -16,7 +16,7 @@ export const SwitchExampleScene = (p: SwitchExampleProps = {}) => {
const style = useSwitchTransition([
{ at: 18, state: "checked", duration: 14 },
{ at: 78, state: "unchecked", duration: 12 },
- ]);
+ ], { mode: p.mode, primary: p.primary });
return (
<Switch
label={p.label ?? "Enable notifications"}
@@ -44,6 +44,12 @@ export const switchExampleCode = (
if (mode !== undefined && mode !== "light") props.push(`mode="${mode}"`);
const propsStr = props.length ? ` ${props.join(" ")}` : "";
+
+ const hookOpts: string[] = [];
+ if (mode !== undefined && mode !== "light") hookOpts.push(`mode: "${mode}"`);
+ if (primary !== undefined) hookOpts.push(`primary: "${primary}"`);
+ const optsStr = hookOpts.length ? `, { ${hookOpts.join(", ")} }` : "";
+
return `import { Switch } from "@/components/remocn/switch";
import { useSwitchTransition } from "@/components/remocn/use-switch-transition";
@@ -51,7 +57,7 @@ export const Scene = () => {
const style = useSwitchTransition([
{ at: 18, state: "checked", duration: 14 },
{ at: 78, state: "unchecked", duration: 12 },
- ]);
+ ]${optsStr});
return <Switch${propsStr} style={style} />;
};`;
diff --git a/components/docs/examples/tabs-example.tsx b/components/docs/examples/tabs-example.tsx
index d92a82ad..3ae56f07 100644
--- a/components/docs/examples/tabs-example.tsx
+++ b/components/docs/examples/tabs-example.tsx
@@ -15,7 +15,7 @@ export const TabsExampleScene = (p: TabsExampleProps = {}) => {
{ at: 18, state: "Account", duration: 16 },
{ at: 58, state: "Password", duration: 18 },
{ at: 94, state: "Settings", duration: 12 },
- ]);
+ ], { variant: p.variant, mode: p.mode });
return (
<Tabs
style={style}
@@ -36,6 +36,11 @@ export const tabsExampleCode = (
if (mode !== undefined && mode !== "light") props.push(`mode="${mode}"`);
const extraProps = props.length ? `\n ${props.join("\n ")}` : "";
+ const hookOpts: string[] = [];
+ if (variant !== undefined && variant !== "pill") hookOpts.push(`variant: "${variant}"`);
+ if (mode !== undefined && mode !== "light") hookOpts.push(`mode: "${mode}"`);
+ const optsStr = hookOpts.length ? `, { ${hookOpts.join(", ")} }` : "";
+
return `import { Tabs } from "@/components/remocn/tabs";
import { useTabsTransition } from "@/components/remocn/use-tabs-transition";
@@ -44,7 +49,7 @@ export const Scene = () => {
{ at: 18, state: "Account", duration: 16 },
{ at: 58, state: "Password", duration: 18 },
{ at: 94, state: "Settings", duration: 12 },
- ]);
+ ]${optsStr});
return <Tabs style={style}${extraProps} />;
};`;
diff --git a/components/docs/examples/toast-example.tsx b/components/docs/examples/toast-example.tsx
index 8d3dc695..8adf6204 100644
--- a/components/docs/examples/toast-example.tsx
+++ b/components/docs/examples/toast-example.tsx
@@ -32,18 +32,24 @@ export const ToastExampleScene = (p: ToastExampleProps = {}) => {
// Button: idle → hover (cursor on button) → press → idle after click.
// The click lands at 68; press starts just before so the dip is visible.
- const buttonStyle = useButtonTransition([
- { at: 40, state: "hover", duration: 16 },
- { at: 62, state: "press", duration: 8 },
- { at: 76, state: "idle", duration: 10 },
- ]);
+ const buttonStyle = useButtonTransition(
+ [
+ { at: 40, state: "hover", duration: 16 },
+ { at: 62, state: "press", duration: 8 },
+ { at: 76, state: "idle", duration: 10 },
+ ],
+ { mode: p.mode },
+ );
// Toast: slides in from below right after the click, holds ~60 frames, then
// auto-dismisses. DEFAULT_DURATION is 12; explicit durations here are clear.
- const toastStyle = useToastTransition([
- { at: 84, state: "visible", duration: 12 },
- { at: 144, state: "hidden", duration: 12 },
- ]);
+ const toastStyle = useToastTransition(
+ [
+ { at: 84, state: "visible", duration: 12 },
+ { at: 144, state: "hidden", duration: 12 },
+ ],
+ { mode: p.mode },
+ );
return (
<div style={{ position: "relative", width: "100%", height: "100%" }}>
@@ -104,6 +110,10 @@ export const toastExampleCode = (
const btnModeStr =
mode !== undefined && mode !== "light" ? ` mode="${mode}"` : "";
+
+ const hookOpts: string[] = [];
+ if (mode !== undefined && mode !== "light") hookOpts.push(`mode: "${mode}"`);
+ const optsStr = hookOpts.length ? `, { ${hookOpts.join(", ")} }` : "";
const toastPropsStr = toastProps.length
? `\n ${toastProps.join("\n ")}\n `
: "";
@@ -131,13 +141,13 @@ export const Scene = () => {
{ at: 40, state: "hover", duration: 16 },
{ at: 62, state: "press", duration: 8 },
{ at: 76, state: "idle", duration: 10 },
- ]);
+ ]${optsStr});
// Toast slides in after the click, holds ~60 frames, then auto-dismisses.
const toastStyle = useToastTransition([
{ at: 84, state: "visible", duration: 12 },
{ at: 144, state: "hidden", duration: 12 },
- ]);
+ ]${optsStr});
return (
<div style={{ position: "relative", width: "100%", height: "100%" }}>
diff --git a/components/docs/examples/toggle-group-example.tsx b/components/docs/examples/toggle-group-example.tsx
index a9cedf84..5aadca62 100644
--- a/components/docs/examples/toggle-group-example.tsx
+++ b/components/docs/examples/toggle-group-example.tsx
@@ -30,10 +30,14 @@ export const ToggleGroupExampleScene = (p: ToggleGroupExampleProps = {}) => {
]);
// Toggle: starts on "Monthly", slides to "Yearly" on first click, back on second.
- const toggleStyle = useToggleGroupTransition([
- { at: 46, state: "Yearly", duration: 14 },
- { at: 92, state: "Monthly", duration: 14 },
- ]);
+ // Forward mode so the animated track/segment colors track the theme.
+ const toggleStyle = useToggleGroupTransition(
+ [
+ { at: 46, state: "Yearly", duration: 14 },
+ { at: 92, state: "Monthly", duration: 14 },
+ ],
+ { mode: p.mode },
+ );
return (
<div style={{ position: "relative", width: "100%", height: "100%" }}>
@@ -50,6 +54,8 @@ export const toggleGroupExampleCode = (
const mode = values.mode as string | undefined;
const modeStr = mode !== undefined && mode !== "light" ? ` mode="${mode}"` : "";
+ const hookOptsStr =
+ mode !== undefined && mode !== "light" ? `, { mode: "${mode}" }` : "";
return `import { Cursor } from "@/components/remocn/cursor";
import { useCursorPath } from "@/components/remocn/use-cursor-path";
@@ -76,7 +82,7 @@ export const Scene = () => {
const toggleStyle = useToggleGroupTransition([
{ at: 46, state: "Yearly", duration: 14 },
{ at: 92, state: "Monthly", duration: 14 },
- ]);
+ ]${hookOptsStr});
return (
<div style={{ position: "relative", width: "100%", height: "100%" }}>
diff --git a/components/docs/examples/tooltip-example.tsx b/components/docs/examples/tooltip-example.tsx
index 87b7c0d4..ef622fe0 100644
--- a/components/docs/examples/tooltip-example.tsx
+++ b/components/docs/examples/tooltip-example.tsx
@@ -34,16 +34,22 @@ export const TooltipExampleScene = (p: TooltipExampleProps = {}) => {
]);
// Button: idle → hover as cursor arrives, back to idle as cursor leaves.
- const buttonStyle = useButtonTransition([
- { at: 28, state: "hover", duration: 8 },
- { at: 100, state: "idle", duration: 8 },
- ]);
+ const buttonStyle = useButtonTransition(
+ [
+ { at: 28, state: "hover", duration: 8 },
+ { at: 100, state: "idle", duration: 8 },
+ ],
+ { mode: p.mode },
+ );
// Tooltip: fades in shortly after cursor arrives, fades out as cursor leaves.
- const tooltipStyle = useTooltipTransition([
- { at: 36, state: "visible", duration: 8 },
- { at: 100, state: "hidden", duration: 8 },
- ]);
+ const tooltipStyle = useTooltipTransition(
+ [
+ { at: 36, state: "visible", duration: 8 },
+ { at: 100, state: "hidden", duration: 8 },
+ ],
+ { mode: p.mode },
+ );
return (
<div style={{ position: "relative", width: "100%", height: "100%" }}>
@@ -89,6 +95,10 @@ export const tooltipExampleCode = (
const mode = values.mode as string | undefined;
const labelStr = label ?? "Add to library";
+ const hookOpts: string[] = [];
+ if (mode !== undefined && mode !== "light") hookOpts.push(`mode: "${mode}"`);
+ const optsStr = hookOpts.length ? `, { ${hookOpts.join(", ")} }` : "";
+
const modeStr =
mode !== undefined && mode !== "light" ? ` mode="${mode}"` : "";
@@ -113,16 +123,20 @@ export const Scene = () => {
]);
// Button responds to the cursor arriving and leaving.
- const buttonStyle = useButtonTransition([
- { at: 28, state: "hover", duration: 8 },
- { at: 100, state: "idle", duration: 8 },
- ]);
+ const buttonStyle = useButtonTransition(
+ [
+ { at: 28, state: "hover", duration: 8 },
+ { at: 100, state: "idle", duration: 8 },
+ ]${optsStr},
+ );
// Tooltip fades in shortly after hover, then fades out as cursor leaves.
- const tooltipStyle = useTooltipTransition([
- { at: 36, state: "visible", duration: 8 },
- { at: 100, state: "hidden", duration: 8 },
- ]);
+ const tooltipStyle = useTooltipTransition(
+ [
+ { at: 36, state: "visible", duration: 8 },
+ { at: 100, state: "hidden", duration: 8 },
+ ]${optsStr},
+ );
return (
<div style={{ position: "relative", width: "100%", height: "100%" }}>