Bridge UI

PasswordField

Password input with visibility toggle and FormField chrome.

Introduction

Use PasswordField when you need a password input with a built-in show/hide toggle, consistent end-adornment layout, and optional controlled visibility (visible / onVisibilityChange).

Use TextField with type="password" only when you want a minimal masked input without toggle UI—for example, a simple credential field where revealing the value is not needed.

Import

import { PasswordField } from "@bridge-ui/vue/Components/PasswordField";
import { PasswordField } from "@bridge-ui/react/Components/PasswordField";

Basic usage

Provide a label and placeholder. Bind the value with value/onChange in React or v-model in Vue. For uncontrolled usage with an initial value, use defaultValue in React or default-value in Vue.

Visibility toggle

The field includes a button to show or hide the password. Control visibility from the parent with visible and onVisibilityChange (React) or v-on:visibility-change (Vue).

Validation

Set error and errorMessage to show invalid styling and an error message below the field.

TextField

Accessibility

PasswordField follows the FormField accessibility pattern. The visibility toggle is a button with an accessible name so screen reader users can show or hide the password. The input uses type="password" when hidden and type="text" when visible.

  • Label, helper text, and error message are linked via controlId and aria-describedby.
  • When error is true, the input receives aria-invalid="true".

Anatomy

PasswordField composes FormField around a masked input and visibility control:

FormField (root)
├── Header — label, optional corner text, required indicator
├── Container — variant shell
│   ├── Input — native input (type toggles between password and text)
│   └── Visibility toggle — button to show or hide the password
└── Footer — description or error message

API

Prop Type Default Description
default-value string — Initial value for uncontrolled usage (without v-model).
v-model string — Two-way binding for the input value.
Prop Type Default Description
defaultValue string — Initial value for uncontrolled usage.
onChange ChangeEventHandler<HTMLInputElement> — Native input change handler.
value string — Input value. Use with onChange for controlled state.
Prop Type Default Description
@visibility-change (visible: boolean) => void — Called when visibility changes.
visible boolean — Controlled password visibility. Omit for uncontrolled mode (internal toggle).
Prop Type Default Description
onVisibilityChange (visible: boolean) => void — Called when visibility changes.
visible boolean — Controlled password visibility. Omit for uncontrolled mode (internal toggle).

PasswordField-specific

Prop Type Default Description
classes PasswordFieldClasses — Classes for the password field.

Inherited from FormField

Prop Type Default Description
classes FormFieldClasses — Class overrides per part.
color FormFieldColor "primary" Color applied to the field control.
controlId string — Associates labels and helper text with the control. Auto-generated when omitted.
corner string — Secondary label text at the inline end of the header row.
customProps FormFieldCustomProps — Props for each part. label accepts Label props (without children); error label colors come from Label.
description string — Helper text below the control. Hidden when error and an error message are set, unless showDescriptionOnError.
disabled boolean false Whether the control is disabled.
end string — Inline-end text inside the field (suffix).
endIcon IconSource — Icon at the inline end.
error boolean false Applies invalid styling. Hides description when an error message is shown, unless showDescriptionOnError.
errorIcon IconSource "alert" Icon shown when invalid and showErrorIcon is enabled.
errorMessage string — Error message below the control.
hideErrorMessage boolean false Does not reserve the error row. That row is also omitted while a description is shown.
label string — Primary label text above the control.
readonly boolean false Whether the control is read-only.
required boolean false Shows a red asterisk on the label.
rounded FormFieldRounded "md" Border radius of the field control.
showDescriptionOnError boolean false Keeps the description visible while the field is invalid.
showErrorIcon boolean true Shows an error icon when invalid.
size FormFieldSize "md" Typography and control sizing.
slots FormFieldSlots — React slots. Vue: #label, #corner, default, #description, #errorMessage, #start, #end.
start string — Inline-start text inside the field (prefix).
startIcon IconSource — Icon at the inline start.
variant FormFieldVariant "outline" Visual variant of the field shell.