Skip to content
caliper ui docs

Components

Password field

A password input with a show and hide control.

Free
pnpm dlx shadcn@latest add @caliper/password-field

Confirm it’s you

Signed in as mara.chen@halden.app

The one you use for halden.app.

Installs components/ui/password-field.tsxDepends on lucide-reactMotion none in component source

When to use

Use it for

  • Sign-in and sign-up forms.
  • Anywhere a person might mistype and want to check.

Skip it when

  • The secret is a one-time code; use the OTP input.

Installation

terminal
pnpm dlx shadcn@latest add @caliper/password-field

Adds its 4 files to components/ui/, each with its own stylesheet, and installs their packages. No account needed. The first part also adds Caliper UI’s tokens; import them once as in Installation.

Usage

This is the code behind the preview above.

example.tsx
import { type ReactNode } from "react"
import { PasswordField } from "@/components/ui/password-field"

function Panel({ title, context, className = "max-w-md", children }: { title: string; context: string; className?: string; children: ReactNode }) {
  return (
    <section className={`grid w-full gap-5 rounded-overlay border border-border bg-background p-6 shadow-resting ${className}`}>
      <div className="grid gap-1">
        <p className="font-medium">{title}</p>
        <p className="text-sm text-muted-foreground">{context}</p>
      </div>
      {children}
    </section>
  );
}

export function CurrentPassword() {
  return (
    <Panel title="Confirm it’s you" context="Signed in as mara.chen@halden.app" className="max-w-sm">
      <PasswordField label="Password" name="password" autoComplete="current-password" description="The one you use for halden.app." defaultValue="harbour-light-42" />
    </Panel>
  );
}

API reference

PasswordField

component

Also accepts the native props of its root element and a ref.

PropTypeDefault
label *string—
descriptionstring—
messages{ show?: string | undefined; hide?: string | undefined; }—

Accessibility

It exposes status semantics, with aria-describedby, aria-pressed, aria-label and aria-hidden kept in step with state. Changes that matter are announced through a live region.

No custom key handling; Tab and the native activation keys do the work.

Motion

It declares no animation in its component source. Any transition comes from its stylesheet, which uses the duration tokens that collapse to instant under prefers-reduced-motion.

All Inputs examples