Components
Password Field
A password input with a show toggle that keeps the caret, a Caps Lock notice and an optional strength meter.
Ombelle · light
Password Field
Very strong
Installation
Run in a project initialized with an Ombelle preset (see Get started). The component uses the saved project preset. Run the command from your app folder; it shows the changes and asks before writing.
pnpm dlx @ombelle-ui/cli@1.1.2 add password-fieldAdds components/ui/password-field.tsx and installs react, clsx, tailwind-merge, lucide-react with lifecycle scripts disabled. This is a client component.
In a liquid glass project the plan adds a notice that accessibility is not guaranteed, because text contrast depends on the background behind the glass.
Usage
example.tsx
import { PasswordField, PasswordFieldControl, PasswordFieldInput, PasswordFieldToggle, PasswordFieldCapsLock, PasswordFieldStrength } from '@/components/ui/password-field'
const checks = [{ label: 'at least 12 characters', test: (value: string) => value.length >= 12 }, { label: 'a number', test: (value: string) => /\d/.test(value) }, { label: 'add a symbol', test: (value: string) => /[^A-Za-z0-9]/.test(value) }]
export function Example(){return <div style={{ display: "grid", gap: "0.5rem" }}><label htmlFor="new-password">Password</label><PasswordField><PasswordFieldControl><PasswordFieldInput id="new-password" name="password" autoComplete="new-password" /><PasswordFieldToggle /></PasswordFieldControl><PasswordFieldCapsLock /><PasswordFieldStrength checks={checks} /></PasswordField></div>}API and states
- API
- PasswordField, PasswordFieldControl, PasswordFieldInput (every input prop but type), PasswordFieldToggle, PasswordFieldCapsLock, PasswordFieldStrength (checks: { label, test } or { label, match })
- Minimum states
- Hidden, shown, Caps Lock on, weak, fair, strong, very strong, disabled, focus
- Native basis
- Native input and button, one template for both editions
- Styles
- Stable in Ombelle, Papier, Organic, Retro futurism, minimalist, neo-brutalism and flat, light and dark. Liquid glass: stable, accessibility not guaranteed.