Password
formcn/passwordFreeComponent
Password input with show/hide toggle
Install it
npx shadcn@latest add https://formcn.dev/r/password.jsonSource
1import { EyeIcon, EyeOffIcon } from 'lucide-react'2import { useState } from 'react'3import {4 InputGroup,5 InputGroupAddon,6 InputGroupButton,7 InputGroupInput,8} from '@/components/ui/input-group'910export function Password(props: React.ComponentProps<typeof InputGroupInput>) {11 const [isVisible, setIsVisible] = useState<boolean>(false)1213 const toggleVisibility = () => setIsVisible((prevState) => !prevState)1415 return (16 <InputGroup>17 <InputGroupInput18 placeholder="password"19 type={isVisible ? 'text' : 'password'}20 {...props}21 />22 <InputGroupAddon align="inline-end">23 <InputGroupButton onClick={toggleVisibility}>24 {isVisible ? (25 <EyeOffIcon size={16} aria-hidden="true" />26 ) : (27 <EyeIcon size={16} aria-hidden="true" />28 )}29 </InputGroupButton>30 </InputGroupAddon>31 </InputGroup>32 )33}
What it pulls in
Other registry items
Files it writes
More from formcn
All 9 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| File Inputfile-upload | formcn | Components | Free | no deps | |
| Multi-selectmulti-select | formcn | Components | Free | no deps | |
| Multi-step formmulti-step-viewer | formcn | Components | Free | 1 dep | |
| Ratingrating | formcn | Components | Free | no deps | |
| Stepperstepper | formcn | Components | Free | no deps | |
| Tag Inputtag-input | formcn | Components | Free | 1 dep |
