aboutsummaryrefslogtreecommitdiffstats
path: root/src/components/atoms/forms/fields/checkbox/checkbox.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'src/components/atoms/forms/fields/checkbox/checkbox.tsx')
-rw-r--r--src/components/atoms/forms/fields/checkbox/checkbox.tsx15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/components/atoms/forms/fields/checkbox/checkbox.tsx b/src/components/atoms/forms/fields/checkbox/checkbox.tsx
index 9c175b7..2a8424e 100644
--- a/src/components/atoms/forms/fields/checkbox/checkbox.tsx
+++ b/src/components/atoms/forms/fields/checkbox/checkbox.tsx
@@ -1,14 +1,19 @@
-import type { FC } from 'react';
+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: FC<CheckboxProps> = (props) => (
- // eslint-disable-next-line react/jsx-no-literals -- Type allowed
- <BooleanField {...props} type="checkbox" />
-);
+export const Checkbox = forwardRef(CheckboxWithRef);