diff --git a/packages/grafana-ui/src/components/Forms/Form.tsx b/packages/grafana-ui/src/components/Forms/Form.tsx index 2425029358e..5f77ecf2ee0 100644 --- a/packages/grafana-ui/src/components/Forms/Form.tsx +++ b/packages/grafana-ui/src/components/Forms/Form.tsx @@ -1,9 +1,9 @@ -import React, { useEffect } from 'react'; +import React, { HTMLProps, useEffect } from 'react'; import { useForm, Mode, OnSubmit, DeepPartial } from 'react-hook-form'; import { FormAPI } from '../../types'; import { css } from 'emotion'; -interface FormProps { +interface FormProps extends Omit, 'onSubmit'> { validateOn?: Mode; validateOnMount?: boolean; validateFieldsOnMount?: string[]; @@ -22,6 +22,7 @@ export function Form({ children, validateOn = 'onSubmit', maxWidth = 400, + ...htmlProps }: FormProps) { const { handleSubmit, register, errors, control, triggerValidation, getValues, formState, watch } = useForm({ mode: validateOn, @@ -41,6 +42,7 @@ export function Form({ width: 100%; `} onSubmit={handleSubmit(onSubmit)} + {...htmlProps} > {children({ register, errors, control, getValues, formState, watch })}