Figma Sign In page using Tailwind and react-hook-form

Om
2 min readApr 25, 2021

--

Yay!

Let’s break the whole Application in two parts

1. Styling

2. Functionalities

The tailwind classes that play a major role in styling the form are.

1 .For proper spacing ( margin ) between the child elements of a parent container we can use space-y-[value] for instance space-y-4

2. For animation on buttons

3. To stack the elements we have used flex flex-col items-center justify-center.

Functionalities

Form handling in React has been made easy-peasy with libraries such as formik and react-hook-form. The later ones v7 is released with some updates in the apis so let’s try to employ those in our application.

The significant changes are :

  1. We no longer have to deal with ref={register} , we can simply use {…register(‘email’)}.

2. For basic validation we can pass another object to the register function.

3. If you want further validations we can simply do it by passing another argument to the register.

4. The errors object can be retrieved using formState which is returned by useForm hook provided by react-hook-form.

The code snippet

--

--