aboutsummaryrefslogtreecommitdiffstats
path: root/src/components/atoms/forms/fields/checkbox/checkbox.tsx
blob: 2a8424e7d09d143e8935b53ab6d56fbb367bd675 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import { forwardRef, type ForwardRefRenderFunction } from 'react';
import { BooleanField, type BooleanFieldProps } from '../boolean-field';

export type CheckboxProps = Omit<BooleanFieldProps, 'type'>;

const CheckboxWithRef: ForwardRefRenderFunction<
  HTMLInputElement,
  CheckboxProps
> = (props, ref) => (
  // eslint-disable-next-line react/jsx-no-literals -- Type allowed
  <BooleanField {...props} ref={ref} type="checkbox" />
);

/**
 * Checkbox component
 *
 * Render a checkbox input type.
 */
export const Checkbox = forwardRef(CheckboxWithRef);