Weftv0.4.0
GitHubFigma
Blade AI
Inputs · PasswordInputstable

Password input

A masked single-line field with a show / hide toggle, help text and validation. One size; square, flat and token-driven.

Preview

#preview

Switch validation, label position and state. The React and CSS tabs update with the preview.

Use 8+ characters with a number and a symbol.

label top · autoComplete="new-password" · helpText
sign-up-password.tsx
import { PasswordInput } from "@blade-ai/weft/components/password-input";

export function SignUpPassword({ value, error, onChange, onBlur }: Props) {
  return (
    <PasswordInput
      label="Password"
      labelPosition="top"
      autoComplete="new-password"
      value={value}
      onChange={onChange}
      onBlur={onBlur} // validate on blur, not per keystroke
      helpText="Use 8+ characters with a number and a symbol."
      validationState={error ? "error" : "none"}
      errorText={error}
    />
  );
}

All states

#all-states

Every state from the Password Input states table, shown with the top label.

Password input · 12 states · size medium · Caps Lock and read-only: UNDEFINED

Use 8+ characters with a number and a symbol.

Default (empty)

Use 8+ characters with a number and a symbol.

Filled · hidden

Use 8+ characters with a number and a symbol.

Filled · visible

Use 8+ characters with a number and a symbol.

Hover

Use 8+ characters with a number and a symbol.

Focus

Use 8+ characters with a number and a symbol.

Toggle hover

Use 8+ characters with a number and a symbol.

Toggle focus

Use 8+ characters with a number and a symbol.

Disabled

Checking password…

Loading

✓ Strong password

Success
Error

Use 8+ characters with a number and a symbol.

Label left

Props

#props

Booleans are is-prefixed. Only medium is drawn; sm / lg are not exposed.

Prop
Type
Default
Description
label *
string
"Password"
Visible label rendered with <label htmlFor>.
labelPosition
"top" | "left"
"top"
'left' = 120px label column beside the input.
placeholder
string
—
UNDEFINED · needs decision (inherited; never drawn). Not exposed.
value · defaultValue
string
—
Controlled or uncontrolled; masked with • unless visible. Never trimmed.
onChange
(value: string) => void
—
Called with the new value.
onBlur
(event: FocusEvent) => void
—
Validate here, not on every keystroke.
visible
boolean
false
true = plain text (type="text"). Controlled when provided.
onVisibleChange
(visible: boolean) => void
—
Called when the toggle is pressed.
showToggle
boolean
true
Eye / EyeOff ghost button, 28 × 28.
validationState
"none" | "error" | "success"
"none"
'error' sets aria-invalid; error text replaces help text.
helpText · errorText · successText
string
—
Help is recommended. Error is prefixed "! ", success "✓ ".
necessityIndicator
"none" | "required" | "optional"
"none"
'required' adds * and aria-required. 'optional' copy: UNDEFINED · needs decision (renders nothing extra).
isDisabled
boolean
false
Disables the toggle too.
isLoading
boolean
false
UNDEFINED · needs decision (inherited; drawn from Text Input). Spinner before the toggle, aria-busy.
autoComplete
"current-password" | "new-password"
"current-password"
'new-password' on sign-up and change.
readOnly · capsLockWarning · toggleLabel · labelWidth
—
—
UNDEFINED · needs decision. Not built.
size
"medium"
"medium"
36px. Small / large: UNDEFINED · needs decision. Not exposed.

Usage

#usage

Short rules for password fields.

Do
Always show a visible label ("Password") and the rules in helpText.
Keep showToggle on so people can check what they typed.
Use autoComplete 'current-password' to sign in and 'new-password' to sign up or change.
Validate on blur or submit, and replace help text with the error.
Don't
Block paste or trim the value.
Show help text and error text at the same time.
Reveal the password by default (visible = false).
Add a clear button; the trailing slot belongs to the toggle.
Use Password Input for OTP codes; use OTP Input.

Accessibility

#accessibility

Native text input plus a native toggle button.

Keyboard
Key
Action
Any character
Types at the caret.
Backspace / Delete
Deletes before / after the caret.
← / → · Home / End
Moves the caret.
Cmd / Ctrl + V
Pastes at the caret.
Tab / Shift + Tab
Input → toggle → next field (the toggle is a native button in the tab order).
Space / Enter on toggle
Shows or hides the password; focus stays on the toggle.
Enter
In the input: native form submit. No extra behaviour.
ARIA
Element
Role / attribute
When
<input>
native textbox · id linked from <label htmlFor>
Always
<input>
aria-describedby="{messageId}"
Help, success or error text is shown
<input>
aria-invalid="true"
validationState = error
<input>
aria-busy="true"
isLoading
<input>
aria-required="true" · required · disabled
necessityIndicator = required · isDisabled
Visibility toggle
<button type="button" aria-label="Show password" | "Hide password" aria-pressed={visible} aria-controls={inputId}>
showToggle = true
Eye / EyeOff icon · spinner
aria-hidden="true"
Always
Caps Lock warning
aria-live="polite" region: UNDEFINED · needs decision
Caps Lock on while focused

Agent Spec

#agent-spec

Machine-readable spec, tables (a)–(g). Same source as /specs/password-input.json and llms.txt.

/specs/password-input.json·component: "PasswordInput"·package: "@blade-ai/weft"·updated 2026-11-24
PropertyValueToken
Height36px (medium only)size.36
Horizontal paddingleft 12px · right 4pxspacing.4 · spacing.2
Gap (value ↔ spinner ↔ toggle)6pxspacing.15
Visibility toggle28 × 28px · icon 16pxsize.28 · size.16 · surface.text.gray.muted
Value / label13px / 20px / 400fonts.size.1200 · lineHeights.100 · fonts.family.text
Label ↔ input ↔ help gaptop: 8px · left: 12pxspacing.3 · spacing.4
Help / error / success text12px / 16px · tracking 0.01emfonts.size.75 · lineHeights.50 · letterSpacings.200
Left label column120pxno token; Text Input sheet uses 80px (labelWidth: UNDEFINED · needs decision)
Border · ring · radius1px · 3px · 0border.width.thin · interactive.border.primary.faded + border.width.3 · border.radius.none
Disabled opacity50%opacity.600