Components
HeroUI v3 InputGroup — inputs with prefix/suffix addons: icons, text, copy button, password toggle, keyboard shortcut, loading state, variants and textarea.
npx shadcn@latest add https://21st.dev/r/larsen66/heroui-input-groupLoading preview...
"use client"
import { Eye, EyeOff } from "lucide-react"
import { Button, Label, TextField } from "@heroui/react"
import { useState } from "react"
import { InputGroup } from "@/components/ui/heroui-input-group"
export default function PasswordToggle() {
const [isVisible, setIsVisible] = useState(false)
return (
<TextField className="w-full max-w-[280px]" name="password">
<Label>Password</Label>
<InputGroup>
<InputGroup.Input
className="w-full max-w-[280px]"
type={isVisible ? "text" : "password"}
value={isVisible ? "87$2h.3diua" : "••••••••"}
/>
<InputGroup.Suffix className="pr-0">
<Button
isIconOnly
aria-label={isVisible ? "Hide password" : "Show password"}
size="sm"
variant="ghost"
onPress={() => setIsVisible(!isVisible)}
>
{isVisible ? <Eye className="size-4" /> : <EyeOff className="size-4" />}
</Button>
</InputGroup.Suffix>
</InputGroup>
</TextField>
)
}
Loading preview...
Loading preview...
Loading preview...
Loading preview...
Loading preview...
Loading preview...
Loading preview...
Loading preview...
Loading preview...