Skip to content
Back

Password fieldPro

A password input whose reveal button slashes the eye with a drawn line, with a Caps Lock warning and a reveal that hides itself again.

oxyn add password-field
At least 12 characters
The code is part of Oxyn Pro

The preview stays free for everyone. Pro opens the code of every Pro component, screen, agent-app template, block and kit, plus the Pro CLI.

Get Pro

Rendered from Rust at build time · goes live when visible

When to use

  • Sign in, unlock a vault, paste an API secret.
  • The user wants to check what they typed without leaving it on screen and to know when Caps Lock is fighting them.

When not to use

  • A new-password field with a four-segment meter, a rule checklist with remaining counts and a strength word that morphs up or down: use Password strength instead.
  • One input for every form: use Text Field instead.
  • The verification-code field: use OTP Input instead.

Installation

Password field is part of Oxyn Pro; the preview is free. Pro items install with the oxyn CLI once your licence is signed in; until then Pro members copy the code from this page.

Terminal
oxyn add password-field

Usage

Dioxus · rust
The code is part of Oxyn Pro

The preview is free. Pro opens the code of every Pro component, screen and template.

Get Pro

Examples

Default

Label, description and reveal.

At least 12 characters
Code Pro
The code is part of Oxyn Pro

The preview is free. Pro opens the code of every Pro component, screen and template.

Get Pro

Timed

Hides again after 10 s (Oxyn plus).

At least 12 characters
Code Pro
The code is part of Oxyn Pro

The preview is free. Pro opens the code of every Pro component, screen and template.

Get Pro

Vault

Fill from the vault (Oxyn plus).

At least 12 characters
Code Pro
The code is part of Oxyn Pro

The preview is free. Pro opens the code of every Pro component, screen and template.

Get Pro

Error

Wrong password.

That password is incorrect
Code Pro
The code is part of Oxyn Pro

The preview is free. Pro opens the code of every Pro component, screen and template.

Get Pro

API reference

PasswordField

PropTypeDefaultDescription
labelrequiredString—Label.
descriptionOption<String>Default::default()Helper copy (linked through aria-describedby).
valueStringDefault::default()Starting value.
placeholderOption<String>Default::default()Placeholder.
autocompleteString"current-password"`current-password` · `new-password`.
nameOption<String>Default::default()Form field name.
requiredboolDefault::default()Required.
errorOption<String>Default::default()Error.
show_labelString"Show password"Toggle name when hidden.
hide_labelString"Hide password"Toggle name when shown.
caps_warningbooltrueOxyn plus: warn when Caps Lock is on.
reveal_forOption<u32>Default::default()Oxyn plus: hide again after this many seconds.
vaultboolDefault::default()Oxyn plus: a "Use saved password" button (the host fills from its vault).
disabledboolDefault::default()Disabled.
on_inputEventHandler<String>—Changed.
on_vaultEventHandler<()>—Vault button pressed.

Read from the Rust signature and doc comments.

Keyboard interactions

KeyAction
EnterorSpaceOn the toggle: show or hide the password
TabInput, then the vault button, then the toggle

Accessibility

  • The toggle is a native button with aria-pressed, aria-controls and a label that switches Show / Hide password.
  • The description (and the Caps Lock warning) is linked with aria-describedby.
  • autocomplete current-password / new-password so password managers work.
From the spec

Native button with aria-pressed, aria-controls and a label that flips between Show and Hide password. The description or Caps warning is linked through aria-describedby. Never announce the password itself.

Motion & interaction

The eye never swaps icons: a single slash draws across it (with a background-coloured mask so it reads on any surface) and undraws when revealed. The value resolves through a short fade on each toggle so the switch between dots and text isn't a jump.

Timing
TransitionDurationEasingReduced motion
Slash draw / undraw180 msease.out (cubic)instant
Value resolve160 msease.outinstant
Caps warning in180 msease.outswap
Timed hide (Oxyn plus)reveal_for s—same

Responsive behaviour

  • Fills its column; the reveal button sits inside the shell and never wraps.
  • Hover styles only on fine pointers.
Edge cases (spec)

Very long secrets scroll inside the input; the toggle never wraps. Password managers keep working (real type=password input, autocomplete). Caps detection uses the typed letter and Shift, so it works where getModifierState is missing. RTL: the toggle sits at the inline end.

Notes for AI

  • Import PasswordField from oxyn_dioxus and include PRIMITIVES_CSS plus the token stylesheet once.
  • A GPUI version exists: PasswordFieldEl in oxyn_gpui.
  • Props to set first: label.
  • Keep its states and timings as they ship; restyle it through the CSS variables rather than by hand.

Guides

Oxyn · 74 free components · 264 Pro components · 96 screens · 20 blocks · Dioxus and GPUI