Forms Core Stable

PasswordInput

A password field with a show/hide reveal toggle and an optional strength meter that never relies on colour alone

Preview

Installation

pnpm add fancy-ui-svelte
import { PasswordInput } from 'fancy-ui-svelte'

Usage

svelte
<script lang="ts">
  import { PasswordInput } from 'fancy-ui-svelte';
</script>

<PasswordInput />

Examples

Basic Usage

With Strength Meter

showStrength turns on the meter and label once there's a value.

New Password

autocomplete="new-password" plus showStrength, inside a FormField.

Props

PropTypeDefaultDescription
value string""Current value; bindable
onValueChange (value: string) => void-Called with the new value on every input event
placeholder string-Shown while the field is empty
disabled booleanfalseBlocks focus and typing; excluded from form submission
readonly booleanfalseBlocks typing but stays focusable and is still submitted
required booleanfalseNative required
invalid booleanfalseDrives the error border and aria-invalid
id string-Element id
name string-Native name, read on form submission
label string-Accessible name — for a control with no visible Label next to it
autocomplete "current-password" | "new-password" | "off""current-password"new-password opts a password manager into offering to generate one
showToggle booleantrueRenders the show/hide reveal button
showStrength booleanfalseRenders the strength meter and label once there's a value
strength (value: string) => { score: 0 | 1 | 2 | 3 | 4; label: string }-Overrides the built-in heuristic scorer — see README before trusting the default
class string-Additional CSS classes, merged onto the field surface
ref HTMLInputElement | nullnullBindable element reference