Checkbox.tsx 512 B

12345678910111213141516
  1. import classNames from "classnames";
  2. import { FunctionComponent, InputHTMLAttributes } from "react"
  3. import styles from './forms.module.css';
  4. interface CheckboxProps extends InputHTMLAttributes<HTMLInputElement> {
  5. label: string
  6. }
  7. export const Checkbox: FunctionComponent<CheckboxProps> = ({ label, id, ...props }) => (
  8. <div className={classNames(styles.input, styles.checkbox)}>
  9. <label htmlFor={id}>
  10. <input type='checkbox' id={id} {...props} />
  11. <span>{label}</span>
  12. </label>
  13. </div>
  14. );