30 lines
584 B
TypeScript
30 lines
584 B
TypeScript
import React, { ReactNode, FormEventHandler, forwardRef } from 'react';
|
|
|
|
export interface FormProps {
|
|
children: ReactNode;
|
|
onSubmit?: FormEventHandler<HTMLFormElement>;
|
|
noValidate?: boolean;
|
|
className?: string;
|
|
}
|
|
|
|
export const Form = forwardRef<HTMLFormElement, FormProps>(({
|
|
children,
|
|
onSubmit,
|
|
noValidate = true,
|
|
className
|
|
}, ref) => {
|
|
return (
|
|
<form
|
|
ref={ref}
|
|
onSubmit={onSubmit}
|
|
noValidate={noValidate}
|
|
className={className}
|
|
style={{ width: '100%' }}
|
|
>
|
|
{children}
|
|
</form>
|
|
);
|
|
});
|
|
|
|
Form.displayName = 'Form';
|