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

Function checkboxExampleCode

components/docs/examples/checkbox-example.tsx:29–59  ·  view source on GitHub ↗
(
  values: Record<string, unknown> = {},
)

Source from the content-addressed store, hash-verified

27 style={style}
28 />
29 );
30};
31
32export const checkboxExampleCode = (
33 values: Record<string, unknown> = {},
34): string => {
35 const label = values.label as string | undefined;
36 const size = values.size as string | undefined;
37 const primary = values.primary as string | undefined;
38
39 const props: string[] = [];
40 if (label !== undefined && label !== "Accept terms and conditions")
41 props.push(`label="${label}"`);
42 if (size !== undefined && size !== "default") props.push(`size="${size}"`);
43 if (primary !== undefined) props.push(`primary="${primary}"`);
44
45 const propsStr = props.length ? ` ${props.join(" ")}` : "";
46
47 const hookOpts: string[] = [];
48 if (primary !== undefined) hookOpts.push(`primary: "${primary}"`);
49 const optsStr = hookOpts.length ? `, { ${hookOpts.join(", ")} }` : "";
50
51 return `import { Checkbox } from "@/components/remocn/checkbox";
52import { useCheckboxTransition } from "@/components/remocn/use-checkbox-transition";
53
54export const Scene = () => {
55 const style = useCheckboxTransition([
56 { at: 18, state: "checked", duration: 14 },
57 { at: 78, state: "unchecked", duration: 12 },
58 ]${optsStr});
59
60 return <Checkbox${propsStr} style={style} />;
61};`;
62};

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected