UNPKG

user-auth-pkg

Version:

A **highly customizable** and **reusable login form component** built with **React Hook Form**, **Yup**, and **Material UI**, supporting **image uploads**, **file inputs**, **CAPTCHA validation**, and flexible UI overrides.

86 lines (65 loc) โ€ข 2.85 kB
# Under Development ## ๐Ÿงพ LoginForm Component | React Login Form | Customizable Login Form A **highly customizable** and **reusable login form component** built with **React Hook Form**, **Yup**, and **Material UI**, supporting **image uploads**, **file inputs**, **CAPTCHA validation**, and flexible UI overrides. --- ## โœจ Features | Login Form Features | Customizable Form Fields - ๐Ÿ”„ **Dynamic field rendering** via configuration (custom field creation and dynamic fields) - ๐Ÿ” **Validation** using **Yup** for strong form input validation - ๐Ÿง  **Smart form handling** with **react-hook-form** for seamless form processing - ๐Ÿ–ผ๏ธ **Built-in support for image uploads** for profile pictures or other media - ๐Ÿ“„ **File input support** for document uploads - ๐Ÿ”’ **Google reCAPTCHA integration** (v2) for **CAPTCHA validation** to prevent bots - ๐ŸŽจ **Customizable components** for form inputs and buttons (UI flexibility) - ๐Ÿ“ก **Axios integration** for form submission to a backend or API --- ## ๐Ÿ’ก Example Usage Below is an example of how to use the `AuthRegisterForm` component for a registration form: ````jsx import { Stack, Grid } from '@mui/material'; import { useRouter } from 'next/router'; import RegisterForm from 'user-auth-pkg'; import RegisterFormConfig from './RegisterFormConfig'; import { CustomInput, CustomButton, CustomImageInput, CustomSelect } from './CustomComponents'; export default function AuthRegisterForm() { const router = useRouter(); const handleSuccess = (response) => { console.log('โœ… Registration response:', response); router.push({ pathname: '/verify-code', }); }; const handleError = (err) => { console.error('โŒ Registration Error:', err); }; return ( <Stack spacing={3}> <RegisterForm config={RegisterFormConfig().fields} onSuccess={handleSuccess} onError={handleError} buttonText="Sign Up" isLoadingText="Sending Request..." textFieldComponent={CustomInput} imageFieldComponent={CustomImageInput} buttonComponent={CustomButton} selectFieldComponent={CustomSelect} axiosConfig={{ url: 'your-api-url', method: 'POST', headers: { 'Content-Type': 'application/json' }, }} enableCaptcha captchaSiteKey="your-captcha-site-key" /> </Stack> ); } ## ๐Ÿ“‚ GitHub Repository Check out the source code and contribute to the project on [GitHub](https://github.com/Abdul-rehman-pwr/user-auth-pkg.git). --- ## ๐Ÿš€ Installation | Install LoginForm React To install the package and required dependencies, run the following commands: ```bash npm install user-auth-pkg # Install the package npm install react react-dom react-hook-form yup axios react-google-recaptcha # Install dependencies ````