Skip to content
WingoUI
ComponentsTemplatesDocsPricingAI agentsBlogChangelogContact
Components
Buttons & Actions
ButtonButton GroupCopy ButtonDelete ButtonTheme ToggleToggleToggle Group
Inputs
Avatar UploadCalendarCheckboxColor PickerComboboxCountry SelectCron PickerCurrency InputDate PickerDate Range PickerDate Time PickerDuration PickerEmail InputEmoji PickerFile UploadFilter BuilderInputInput GroupListboxMasked InputMention InputMonth PickerMulti SelectNumber InputOTP InputPassword InputPhone InputRadio GroupRatingSearch InputSegmented ControlSelectSignature PadSliderSwitchTag InputTextareaTime PickerTimezone SelectTree Select
Forms
Address InputBooking WidgetCSV ImportFieldForm WizardInline EditInvoice line itemsRich Text EditorSchema Builder
Navigation
Back To TopBounce SidebarBreadcrumbCommand MenuGlobal SearchGooey NavHook SidebarNav MenuNav TabsPaginationProximity SidebarScroll ProgressSidebarStepsTable Of ContentsTabsTopbarUser MenuWorkspace Switcher
Overlays
Alert DialogContext MenuDialogDrawerDropdown MenuFamily DrawerHover CardPopoverShare DialogSheetShortcuts DialogTooltipTour
Feedback
AlertBannerCookie ConsentEmoji ReactionEmpty StateNotification BellNotification CenterProgressRoute ProgressSetup ChecklistSkeletonSpinnerToast
Data Display
Approval FlowAvatarBadgeCalendar ViewCode BlockComment ThreadContact cardCountdownDescription ListDiff ViewerFile ListFile managerFolderGanttJSON ViewerKbdLog ViewerMarkdownPresenceSchedulerTagTimelineTree View
Tables & Lists
Audit LogData TableDeal PipelineEditable GridKanbanListMembers tablePermissions MatrixTableTask ListVirtual List
Charts & Stats
Animated CounterArea chartBar chartDonut chartFunnel chartGaugeGitHub ActivityHeatmap calendarLeaderboardLine chartRadar chartRadial barSparklineStat CardTrackerTrend badge
Layout
AccordionApp ShellCardCollapsibleDetail LayoutEntity HeaderPage HeaderScroll AreaSeparatorSettings LayoutSplit ViewToolbar
Media
Audio PlayerCarouselCSV ViewerDOCX EditorDOCX ViewerExcel ViewerFile SystemImage compareImage CropperImage GalleryImage LightboxLocation MapPDF ViewerPowerPoint ViewerQR CodeStep PlayerVideo Player
AI Kit
Agent Status CardChat MessageChat ThreadChat WidgetConversation ListFluid OrbGrid RevealMatrix OrbModel PickerPrompt InputReasoning IndicatorRule BuilderSuggestion ChipsTool Call TimelineUsage MeterVoice InputWorkflow Canvas
Text & Effects
Background PatternGravity LettersMarqueeTerminalText AnimateText Rotate
Mobile
Action SheetBottom Tab BarFABHaptic ButtonHero HeaderInstall PromptLarge Title HeaderNotification BannerOnboarding CarouselPicker WheelPull To RefreshSlide To ConfirmSticky CTA BarSwipe DeckSwipeable Tabs
Commerce
Cart drawerCategory pickerCheckout stepsCoupon inputFavorite buttonFilter panelListing cardListing gridOrder trackerPricePrice rangePricing tableProduct galleryQuantity stepperReviewsSeller card
Marketing Sections
App Download SectionBlog Cards SectionCTA SectionFAQ SectionFeature GridFeature ShowcaseHero SectionIntegrations SectionLogo CloudMarketing FooterMarketing HeaderMarketing SectionNewsletter SectionPricing SectionStats SectionSteps SectionTeam SectionTestimonials SectionTimeline SectionVideo Section
Blocks
Admin Dashboard PageAdmin ShellAI Chat PageAPI Keys PageAutomation Builder PageCheckout PageCRM Contact PageCRM Pipeline PageError PagesInbox PageInvoice PageKPI DashboardListing Detail PageLogin PageMarketplace Home PageMarketplace Search PageMarketplace ShellMobile App HomeOnboarding FlowOrder History PagePost Listing WizardPricing PageProfile PageRegister PageSettings PageUsers Admin Page
Templates
About PageAcademy PageAccessibility PageAffiliate PageAgency PageAI Product PageAppointment Booking PageBlog PageBlog Post PageBug Bounty PageCareers PageChangelog PageCommunity PageCompare PageContact PageCustomer Story PageCustomers PageDemo Booking PageDevelopers PageDocs Home PageDownload PageEnterprise PageEvents PageExperts PageFAQ PageFeature PageGlossary PageHelp Article PageHelp Center PageHome Services PageImpact PageIntegration Detail PageIntegrations PageJob Detail PageLanding PageLaunch PageLegal PageManifesto PagePortfolio PagePress PageProduct Tour PagePromo PageReal Estate PageReferral PageResearch Report PageRestaurant PageRoadmap PageROI Calculator PageSecurity PageSolutions PageStartups PageStatus PageStorefront PageSwitch PageTemplate Gallery PageTravel PageWaitlist PageYear in Review Page
Hooks & Utilities
AI ChatChart kitCommerceDate utilsFile exportFile typesFiltersForm validationHapticsInvoicingMotion presetsNavigationNumber formatRelative timeRomanian locationsSpreadsheetText matchTonesUIProvideruseClipboarduseConsentuseControllableStateuseCooldownuseDebounceuseKeyboardInsetuseLocaleuseLongPressuseMediaControlsuseMediaQueryuseOverflowItemsusePersistedStateuseScrollEdgesuseScrollStateuseSelectionuseShortcutuseStickToBottom
GalleryTheme

Inputs

Password Input

Inputs

Password Input React component for Tailwind CSS v4

OTP InputPhone Input
Live props
Field
label
description
error
required
disabled
invalid
readOnly
Content
placeholder
defaultValue
showLabel
hideLabel
capsLockLabel
strengthCaption
generateLabel
ruleMetLabel
ruleUnmetLabel
Appearance
size
variant
radius
accent
floatingLabel
Behavior
defaultVisible
showToggle
capsLockWarning
maxLengthNo limit
Strength
strength
showRules
generate
generateLength16
Code
import { PasswordInput } from "@/components/ui/password-input"

<PasswordInput />
  1. Home
  2. Components
  3. Inputs
  4. Password Input
Pro

Password Input React component for Tailwind CSS v4

v1.0.0·Added in 1.0.0

A password field with a caret-safe reveal toggle, a Caps Lock warning and, for sign-up, a strength meter, rules checklist and generator.

Tap the eye and the dots turn into text with the icon turning a quarter over; the caret and any selection stay exactly where they were, and the button stays in the Tab order. With Caps Lock on, a small amber warning slides in under the box and leaves when you release it or leave the field. With strength on, four bars fill left to right as you type, red, then amber, then green, with the verdict next to them, and a checklist opens on focus with each rule drawing its check the moment it is met; it stays open while there is text, so the submit button never jumps away under your finger. The wand fills a random 16-character password, reveals it until you leave the field and scores it Strong. On a phone both buttons have 44px hit areas, iOS never zooms and the checklist scrolls into view above the keyboard.

Password Input is a Pro React component in the React input components category, written in TypeScript for React 19 and Tailwind CSS v4. It installs as source with npx wingo-ui@latest add password-input, together with Input, Field, Motion presets, useControllableState, useMediaQuery and 1 more and the npm packages motion and lucide-react.

Add to a project

Requirements: React 19 and Tailwind CSS v4, in Next.js (App Router or Pages), Vite or React Router. Installation guide · Next.js setup · Vite setup

npx wingo-ui@latest add password-input

Password Input is part of Pro, with 298 more Pro items: $8 a month or $150 once. 14-day refund before you download any Pro item. See plans

Usage

Import PasswordInput from @/components/ui/password-input.

import { PasswordInput, passwordRules } from "@/components/ui/password-input"

const rules = passwordRules({
  minLength: 10,
  labels: { length: (n) => "At least " + n + " characters", lower: "One lowercase letter", upper: "One uppercase letter", number: "One digit", symbol: "One symbol" },
})

export function SignUp() {
  return (
    <form className="flex flex-col gap-4">
      <PasswordInput
        name="password"
        label="Password"
        strength
        rules={rules}
        strengthLabels={["Too weak", "Weak", "Okay", "Good", "Strong"]}
        generate
        required
      />
    </form>
  )
}

Props

  • labeldefault ""
    ReactNode

    The label above the box, linked with htmlFor.

  • descriptiondefault ""
    ReactNode

    Helper text under the box, linked with aria-describedby. The error takes its place while it shows.

  • errordefault ""
    ReactNode

    Replaces the description, slides in and marks the field invalid.

  • requireddefault false
    boolean

    The red mark after the label and the native required attribute.

  • disableddefault false
    boolean

    Dims the field and blocks input and the reveal toggle; the generator hides.

  • invaliddefault false
    boolean

    The red ring and aria-invalid without a message, when the form shows the error elsewhere.

  • readOnlydefault false
    boolean

    The password stays selectable and can still be revealed, but cannot change; the generator hides. The demo fills in a sample value.

  • placeholderdefault ""
    string

    Hint text while the field is empty.

  • defaultValuedefault ""
    string

    The starting password while uncontrolled; value and onValueChange control it. The meter scores this first value until the field is focused, so a password manager filling the field never makes it flash.

  • showLabeldefault "Show password"
    string

    The toggle's aria-label and hover title while the password is hidden.

  • hideLabeldefault "Hide password"
    string

    The toggle's aria-label and hover title while the password shows.

  • capsLockLabeldefault "Caps Lock is on"
    ReactNode

    The warning under the box.

  • strengthCaptiondefault "Password strength"
    string

    The caption under the meter, left of the verdict, and the prefix screen readers hear.

  • generateLabeldefault "Generate a strong password"
    string

    The wand button's aria-label and hover title.

  • ruleMetLabeldefault "met"
    string

    Read by screen readers after a met rule, visually hidden.

  • ruleUnmetLabeldefault "not met"
    string

    Read by screen readers after a rule that is not met yet, visually hidden.

  • sizedefault "md"
    "sm" | "md" | "lg"

    Height 32 / 40 / 48px like every field (md 44px on touch); the eye and wand buttons follow.

  • variantdefault "soft"
    "soft" | "outline" | "underline" | "ghost"

    The field box look, shared with Input.

  • radiusdefault "md"
    "none" | "sm" | "md" | "lg" | "full"

    Corner shape, scaled with the size; full makes a pill.

  • accentdefault ""
    string

    Any CSS color for the focus ring and the caret. Empty uses the ring token.

  • floatingLabeldefault false
    boolean

    The label rests inside the box and floats up on focus or when filled, like Input.

  • defaultVisibledefault false
    boolean

    Starts with the password shown as text. Use visible and onVisibleChange to control it.

  • showToggledefault true
    boolean

    The eye button at the end of the box. It is a real button in the Tab order with aria-pressed and aria-controls; switching keeps the caret and selection.

  • strengthdefault false
    boolean

    Turns the field into a sign-up field: the four-bar meter with its verdict, the rules checklist and autoComplete new-password. The verdict is announced politely 500ms after typing stops.

  • showRulesdefault "focus"
    "focus" | "always" | "never"

    When strength is on: the checklist opens on focus and stays while there is text (so the button under it never moves on blur), always shows, or never shows.

  • capsLockWarningdefault true
    boolean

    Reads Caps Lock from the key and pointer events while the field is focused and shows the warning (role status). Hidden on blur; phones never report it.

  • generatedefault false
    boolean

    A wand button before the eye: fills a random password from crypto.getRandomValues (no 0 O l 1 I, at least one lowercase, uppercase, digit and symbol, no runs), fires onChange like typing, and reveals it until focus leaves the field.

  • generateLengthdefault 16
    number

    Length of a generated password.

  • maxLengthdefault 0
    number

    The native character limit, also applied to typing after a generated password. 0 means no limit.

  • visible
    boolean

    Shown as text, controlled. Without onVisibleChange the toggle does nothing.

  • onVisibleChange
    (visible: boolean) => void

    Fires when the toggle, the generator or the blur after a generated password changes the visibility.

  • rules
    PasswordRule[]

    The checklist, { id, label, test(password) }. Defaults to passwordRules(): at least 8 characters, a lowercase letter, an uppercase letter, a number, a symbol. The rule with id length also sets the minimum for the score.

  • score
    (password: string) => PasswordScore

    Replaces the scorer, e.g. with zxcvbn loaded by the app. Defaults to scorePassword (see Parts), a quick guide rather than a guarantee.

  • strengthLabelsdefault "["Too weak", "Weak", "Fair", "Good", "Strong"]"
    [string, string, string, string, string]

    The verdict per score, default ["Too weak", "Weak", "Fair", "Good", "Strong"].

  • onGenerate
    (password: string) => void

    Called with the generated password, e.g. to offer a copy button.

  • showIcon
    ReactNode

    The toggle icon while hidden (Eye by default).

  • hideIcon
    ReactNode

    The toggle icon while shown (EyeOff by default).

  • generateIcon
    ReactNode

    The generator icon (WandSparkles by default).

  • autoComplete
    string

    Defaults to "current-password", or "new-password" with strength or generate, so password managers save and suggest correctly. A manager's own icon may sit over the end of the box; there is room for it before the toggle.

  • enterKeyHint
    "enter" | "done" | "go" | "next" | "previous" | "search" | "send"

    The label of the phone keyboard's return key: "go" for a login field, "next" with strength (a sign-up form usually continues).

  • value
    string

    The password, controlled, with onValueChange. Every other Input prop works too: name, onBlur, prefix, leftIcon, fieldProps... (not clearable, loading, showCount or rightIcon: the eye and wand own the end of the box).

  • onValueChange
    (value: string) => void

    Fires with the new password on every edit, including a generated one.

  • onChange
    (event: ChangeEvent<HTMLInputElement>) => void

    The native change event, untouched. A generated password fires it too, like typing.

  • prefix
    ReactNode

    Text or an element before the input, in the muted addon look.

  • suffix
    ReactNode

    Text or an element after the input, placed before the wand and eye buttons.

  • leftIcon
    ReactNode

    A leading icon such as a lock; unsized svgs follow the size (14 / 16 / 18px).

  • fieldProps
    Partial<FieldProps>

    Anything else for the Field wrapper, e.g. labelAction: <a href="/reset">Forgot password?</a>.

  • ref
    RefObject<HTMLInputElement | null> or (node) => void

    The native input.

  • classNames
    Partial<Record<InputSlot | "root" | "toggle" | "generate" | "strength" | "meter" | "segment" | "strengthLabel" | "rules" | "rule" | "capsLock", string>>

    Extra classes for the inner parts: the Input keys (box, input, label...) plus the password parts.

  • className
    string

    Classes for the root wrapper around the field, the warning, the meter and the checklist.

Parts

  • passwordRules

    function

    Builds the default checklist (length, lowercase, uppercase, number, symbol) with your minimum length and translated labels. Letters are Unicode aware, so é and Ø count.

    • minLengthdefault 8
      number

      The length rule's minimum; also the length below which scorePassword returns 0.

    • labels
      Partial<PasswordRuleLabels>

      Text per rule: length (a node or (min) => node), lower, upper, number, symbol.

    • returns
      PasswordRule[]

      Rules to pass to the rules prop.

  • scorePassword

    function

    The default strength score from 0 to 4: 0 when empty, short or common (password, qwerty...), +1 per met rule beyond length (max 3), +1 for 12+ characters, -1 for repeats or runs like 1234.

    • password*
      string

      The text to score.

    • rulesdefault "passwordRules()"
      PasswordRule[]

      The checklist; its length rule sets the minimum.

    • returns
      0 | 1 | 2 | 3 | 4

      The score the meter shows.

  • generatePassword

    function

    A random password with at least one lowercase letter, uppercase letter, digit and symbol, drawn with crypto.getRandomValues and free of look-alikes (0, O, l, 1, I). The wand button uses it.

    • lengthdefault 16
      number

      Characters, clamped to 4 to 128.

    • returns
      string

      The new password.

  • PasswordRule

    type

    One checklist row: { id, label, test(password) => boolean }.

  • PasswordScore

    type

    The strength score, 0 (too weak) to 4 (strong).

Examples

Sign-up with rules

Custom rule copy from passwordRules({ minLength: 10, labels }) and custom verdicts: the bars fill as you type and each rule draws its check when met.

Caps Lock warning

Turn Caps Lock on and type: an amber warning slides in under the box, and leaves when you turn it off or leave the field.

Generator

The wand fills a random 16-character password (no look-alike characters), reveals it until you leave the field and scores it strong; the copy button sits outside.

Confirm password

A second field checks the match on blur and turns green once both are the same.

Controlled visibility

visible and onVisibleChange driven by one checkbox for two fields, with showToggle off.

Sizes and variants

sm, md and lg, then outline with the generator, underline, and a ghost pill that starts visible.

Dependencies

motionlucide-reactinputfieldmotionuse-controllable-stateuse-media-queryui-config

Files

  • components/ui/password-input.tsx

FAQ

Is the React Password Input component free?

The preview, props and docs are free; copying the source needs a Pro plan. See plans.

How do I install Password Input?

Run npx wingo-ui@latest add password-input. It also adds the Wingo UI items it builds on (Input, Field, Motion presets, useControllableState, useMediaQuery and 1 more) and the npm packages motion and lucide-react. With shadcn, add the @wingo-ui registry with your API key, then run npx shadcn@latest add @wingo-ui/password-input.

How does Password Input behave on phones?

On a phone both buttons have 44px hit areas, iOS never zooms and the checklist scrolls into view above the keyboard.

See also

InputFieldOTP InputButton

Used in

Login PageRegister PageSettings Page

More React input components

Phone InputRadio GroupRatingSearch InputSelectSignature Pad
All 40 React input components

Articles using this component

  • Shadcn Password Input: Show/Hide, Strength Meter, Caps Lock

    Component guides · Nov 5, 2026 · 9 min read

  • Shadcn Login Page: Magic Link, Codes, 2FA and Recovery

    Build it: screens and apps · Oct 16, 2026 · 11 min read

PreviousOTP InputNext Phone Input

Sign in

Welcome back! Sign in to your account.

Forgot password?

No account? Create one for free

  • Tap the eye: the caret stays exactly where it was
  • With Caps Lock on you see “Caps Lock is on”