aboutsummaryrefslogtreecommitdiffstats
path: root/src/components/atoms/forms/form/form.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'src/components/atoms/forms/form/form.tsx')
-rw-r--r--src/components/atoms/forms/form/form.tsx28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/components/atoms/forms/form/form.tsx b/src/components/atoms/forms/form/form.tsx
new file mode 100644
index 0000000..86481d2
--- /dev/null
+++ b/src/components/atoms/forms/form/form.tsx
@@ -0,0 +1,28 @@
+import {
+ type FormHTMLAttributes,
+ forwardRef,
+ type ForwardRefRenderFunction,
+} from 'react';
+
+export type FormRole = 'form' | 'search' | 'none' | 'presentation';
+
+export type FormProps = FormHTMLAttributes<HTMLFormElement> & {
+ /**
+ * An accessible role.
+ */
+ role?: FormRole;
+};
+
+const FormWithRef: ForwardRefRenderFunction<HTMLFormElement, FormProps> = (
+ { children, ...props },
+ ref
+) => (
+ <form {...props} ref={ref}>
+ {children}
+ </form>
+);
+
+/**
+ * Form component.
+ */
+export const Form = forwardRef(FormWithRef);