Password Input

Password field with an eye icon that morphs to eye-off, a caps-lock warning, a segmented strength meter whose bars spring-fill and recolor with a sliding Weak/Fair/Good/Strong label from a length-weighted NIST-style heuristic, an optional requirement checklist whose items check off with a draw-in tick, and onStrengthChange.

Preview

Password Input preview width

Install

Add it with the shadcn CLI, or copy the source manually.

$ bunx --bun shadcn add @karaui/password-input
@karaui not found? Add it to components.json
{
  "registries": {
    "@karaui": "https://karaui.kamisama-v0.my.id/r/{name}.json"
  }
}

@karaui is in shadcn's public registry directory, so the latest CLI needs no setup. On an older CLI, merge this into the existing file once and every @karaui/… install resolves.

API Reference

strengthMeter?
boolean

Show the segmented strength meter once something is typed. Default true.

true
requirements?
boolean | PasswordRequirement[]

Requirement checklist under the field. `true` uses `defaultPasswordRequirements(minLength)`; pass an array for custom rules.

false
minLength?
number

Length below which the score is 0 ("Too short"). Default 8.

8
onStrengthChange?
((strength: PasswordStrength, label: string) => void)

Fires whenever the 0-4 score changes.

—
revealable?
boolean

Allow revealing the password. Default true.

true
icon?
ReactNode

Left icon. Defaults to a lock; pass `null` for none.

—
value?
string
—
defaultValue?
string
—
className?
string
—
onChange?
((value: string) => void)
—
error?
string | boolean

Truthy error triggers a shake, red border and (if a string) a message.

—
label?
string
—
classNames?
InputClassNames
—

Updated