import React, { ChangeEvent } from 'react'; export interface CheckboxProps { /** * A function that will run after the input has changed, it will return the value of the input for you to use in the parent component. */ callback: (e: ChangeEvent, id: string) => void; /** * Should the checkbox show as checked or not. */ checked: boolean; /** * A custom data attribute value you can pass to hook into the input if needed. */ dataAttr?: string; /** * Should the input be disabled or not. Use with a state var to determine when the input can be edited. */ disabled: boolean; /** * An id to be added to the input itself, not the wrapping label. */ id: string; /** * Classes to be added to the wrapping label. */ theme?: string; /** * The label text title of the input. */ title: string | React.ReactNode; /** * The value of the checkbox, will be accessible as part of "e" in the callback */ value: string; /** * The spacing of the text as a tailwind class, defaults to `pl-3`. */ spacing?: string; /** * Classes to be added to the input element. */ inputTheme?: string; /** * Classes to be added to the checkmark element. */ checkTheme?: string; /** * Is the checkbox controlled or not. If so, this should be true. If not, leave it undefined. */ controlled?: boolean; } const Checkbox = ({ callback, checked, dataAttr = '', disabled, id, theme = '', title, value, spacing = 'pl-3', inputTheme = '', checkTheme = '', controlled, }: CheckboxProps) => (