MCPcopy Create free account
hub / github.com/Remocn/remocn / toggleGroupExampleCode

Function toggleGroupExampleCode

components/docs/examples/toggle-group-example.tsx:45–82  ·  view source on GitHub ↗
(
  _values: Record<string, unknown> = {},
)

Source from the content-addressed store, hash-verified

43};
44
45export const toggleGroupExampleCode = (
46 _values: Record<string, unknown> = {},
47): string => {
48 return `import { Cursor } from "@/components/remocn/cursor";
49import { useCursorPath } from "@/components/remocn/use-cursor-path";
50import { ToggleGroup } from "@/components/remocn/toggle-group";
51import { useToggleGroupTransition } from "@/components/remocn/use-toggle-group-transition";
52
53// Default size geometry: pad=4, segMinWidth=88, 2 segments → container 184px wide.
54// Centered on a 1280×720 canvas; adjust for your own canvas and segment count.
55const MONTHLY_X = 596;
56const YEARLY_X = 684;
57const TOGGLE_Y = 360;
58
59export const Scene = () => {
60 // Cursor eases to "Yearly", clicks, then eases to "Monthly" and clicks again.
61 const cursorStyle = useCursorPath([
62 { at: 0, x: 80, y: 60 },
63 { at: 32, x: YEARLY_X, y: TOGGLE_Y, duration: 28 },
64 { at: 44, x: YEARLY_X, y: TOGGLE_Y, click: true, duration: 0 },
65 { at: 80, x: MONTHLY_X, y: TOGGLE_Y, duration: 20 },
66 { at: 90, x: MONTHLY_X, y: TOGGLE_Y, click: true, duration: 0 },
67 ]);
68
69 // Toggle slides "Monthly" → "Yearly" → "Monthly", frame-synced with cursor clicks.
70 const toggleStyle = useToggleGroupTransition([
71 { at: 46, state: "Yearly", duration: 14 },
72 { at: 92, state: "Monthly", duration: 14 },
73 ]);
74
75 return (
76 <div style={{ position: "relative", width: "100%", height: "100%" }}>
77 <ToggleGroup style={toggleStyle} />
78 <Cursor style={cursorStyle} variant="pointer" />
79 </div>
80 );
81};`;
82};

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected