React hook that enhances password inputs with a built-in show/hide toggle functionality, designed for seamless integration and improved user experience.
npm i @omergulcicek/password-input
const { inputProps, InputWrapper, wrapperProps, } = usePasswordInput({ password: true, }); return ( <InputWrapper {...wrapperProps}> <Input {...inputProps} placeholder="Enter your password" /> </InputWrapper> )
const { inputProps, InputWrapper, wrapperProps, } = usePasswordInput({ password: { icons: { show: <span className="text-xs">Show</span>, hide: <span className="text-xs">Hide</span>, }, }, }); return ( <InputWrapper {...wrapperProps}> <Input {...inputProps} placeholder="Enter your password" /> </InputWrapper> )
import { Eye, EyeOff } from "lucide-react"; const { inputProps, InputWrapper, wrapperProps, } = usePasswordInput({ password: { icons: { show: <Eye className="size-4" />, hide: <EyeOff className="size-4" />, }, }, }); return ( <InputWrapper {...wrapperProps}> <Input {...inputProps} placeholder="Enter your password" /> </InputWrapper> )