checkbox.tsx 550 B

1234567891011121314151617181920
  1. "use client";
  2. import type { ComponentRenderProps } from "./types";
  3. import { baseClass, getCustomClass } from "./utils";
  4. export function Checkbox({ element }: ComponentRenderProps) {
  5. const { props } = element;
  6. const customClass = getCustomClass(props);
  7. return (
  8. <label
  9. className={`flex items-center gap-2 text-xs ${baseClass} ${customClass}`}
  10. >
  11. <div
  12. className={`w-3.5 h-3.5 border border-border rounded-sm ${props.checked ? "bg-foreground" : "bg-card"}`}
  13. />
  14. {props.label as string}
  15. </label>
  16. );
  17. }