diff --git a/src/components/forms/Form.tsx b/src/components/forms/Form.tsx index 4a833b2..9c85e8c 100644 --- a/src/components/forms/Form.tsx +++ b/src/components/forms/Form.tsx @@ -19,11 +19,19 @@ import {Button} from "../inputs/Button"; export interface FormProps extends Types.BluelibHTMLProps {} -export function Form({...props}: FormProps): JSX.Element { +export function Form({onSubmit, ...props}: FormProps): JSX.Element { props.bluelibClassNames = mergeClassNames(props.bluelibClassNames, "form") + const onSubmitPreventDefault = React.useCallback( + event => { + if(onSubmit) onSubmit(event) + event.preventDefault() + }, + [onSubmit] + ) + return ( - + ) }