import type { InputHTMLAttributes } from "react"; import React, { forwardRef } from "react"; import classNames from "@calcom/lib/classNames"; import InfoBadge from "@components/ui/InfoBadge"; type Props = InputHTMLAttributes & { label?: React.ReactNode; description: string; descriptionAsLabel?: boolean; informationIconText?: string; }; const CheckboxField = forwardRef( ({ label, description, informationIconText, ...rest }, ref) => { const descriptionAsLabel = !label || rest.descriptionAsLabel; return ( {label && ( {React.createElement( descriptionAsLabel ? "div" : "label", { className: "flex text-sm font-medium text-default", ...(!descriptionAsLabel ? { htmlFor: rest.id, } : {}), }, label )} )} {React.createElement( descriptionAsLabel ? "label" : "div", { className: classNames( "relative flex items-start", descriptionAsLabel ? "text-default" : "text-emphasis" ), }, <> {description} > )} {informationIconText && } ); } ); CheckboxField.displayName = "CheckboxField"; export default CheckboxField;