Password Input
A secret field with a show and hide toggle.
Use at least 8 characters.
Install and use
The first command adds the component and the Mine theme, the second adds this example. Render <Mine> once near your root for the skin, sounds and narrator.
"use client"
import { Field, FieldDescription, FieldLabel } from "@/components/ui/field"
import {
PasswordInput,
PasswordInputControl,
PasswordInputToggle,
} from "@/components/ui/password-input"
import { EyeIcon, EyeOffIcon } from "lucide-react"
function Example() {
return (
<Field name="password">
<FieldLabel>Password</FieldLabel>
<PasswordInput>
<PasswordInputControl />
<PasswordInputToggle aria-label="Show password">
{(state) =>
state.visible ? (
<EyeOffIcon aria-hidden="true" />
) : (
<EyeIcon aria-hidden="true" />
)
}
</PasswordInputToggle>
</PasswordInput>
<FieldDescription>Use at least 8 characters.</FieldDescription>
</Field>
)
}
export { Example }