diff --git a/public/app/core/components/Login/LoginForm.tsx b/public/app/core/components/Login/LoginForm.tsx index 66ceb149afe..7eea1bb5dc6 100644 --- a/public/app/core/components/Login/LoginForm.tsx +++ b/public/app/core/components/Login/LoginForm.tsx @@ -1,9 +1,10 @@ import { css } from '@emotion/css'; import React, { ReactElement, useId } from 'react'; +import { useForm } from 'react-hook-form'; import { GrafanaTheme2 } from '@grafana/data'; import { selectors } from '@grafana/e2e-selectors'; -import { Button, Form, Input, Field, useStyles2 } from '@grafana/ui'; +import { Button, Input, Field, useStyles2 } from '@grafana/ui'; import { PasswordField } from '../PasswordField/PasswordField'; @@ -21,42 +22,43 @@ export const LoginForm = ({ children, onSubmit, isLoggingIn, passwordHint, login const styles = useStyles2(getStyles); const usernameId = useId(); const passwordId = useId(); + const { + handleSubmit, + register, + formState: { errors }, + } = useForm({ mode: 'onChange' }); return (
-
- {({ register, errors }) => ( - <> - - - - - - - - {children} - - )} -
+
+ + + + + + + + {children} +
); };