mirror of
https://github.com/dyzulk/trustlab.git
synced 2026-01-26 13:32:06 +07:00
24 lines
543 B
TypeScript
24 lines
543 B
TypeScript
import React, { FC, ReactNode, FormEvent } from "react";
|
|
|
|
interface FormProps {
|
|
onSubmit: (event: FormEvent<HTMLFormElement>) => void;
|
|
children: ReactNode;
|
|
className?: string;
|
|
}
|
|
|
|
const Form: FC<FormProps> = ({ onSubmit, children, className }) => {
|
|
return (
|
|
<form
|
|
onSubmit={(event) => {
|
|
event.preventDefault(); // Prevent default form submission
|
|
onSubmit(event);
|
|
}}
|
|
className={` ${className}`} // Default spacing between form fields
|
|
>
|
|
{children}
|
|
</form>
|
|
);
|
|
};
|
|
|
|
export default Form;
|