diff --git a/src/components/Checkbox.tsx b/src/components/Checkbox.tsx new file mode 100644 index 0000000..ca6386e --- /dev/null +++ b/src/components/Checkbox.tsx @@ -0,0 +1,28 @@ +import React from "react"; + +type CheckBoxProps = { + /** + * here any text can be written to be a label for the checkbox + */ + label: string; + /** + * onChange callback + */ + onChange?: (value: boolean) => void; +} & Omit, "onChange" | "type">; + +const CheckBox = ({ className, onChange, label, ...props }: CheckBoxProps) => { + return ( +
+ onChange && onChange(!props.checked)} + className="hover:bg-sky-700 focus:bg-sky-900 active:bg-sky-300 text-black" + type="checkbox" + {...props} + /> + +
+ ); +}; + +export default CheckBox;