HomeDocsComponentsBlocksChartsThemes
Introduction
  • Introduction
  • Installation
  • Themes
  • llms.txt
Components
  • Accordion
  • Alert
  • Alert Dialog
  • Amount
  • Aspect Ratio
  • Audio Player
  • Avatar
  • Avatar Upload
  • Badge
  • Banner
  • Breadcrumb
  • Button
  • Button Group
  • Calendar
  • Card
  • Carousel
  • Chart
  • Checkbox
  • Code Block
  • Collapsible
  • Color Picker
  • Combobox
  • Command
  • Context Menu
  • Copy Button
  • Countdown
  • Data Grid
  • Data Table
  • Date Picker
  • Date Range Picker
  • Description List
  • Device Mockup
  • Dialog
  • Direction
  • Dot Loader
  • Drawer
  • Dropdown Menu
  • Empty
  • Field
  • File Upload
  • Hover Card
  • Input
  • Input Group
  • Input OTP
  • Item
  • Kanban
  • Kbd
  • Label
  • Menubar
  • Meter
  • Multi Select
  • Native Select
  • Navigation Menu
  • Number Field
  • Pagination
  • Password Strength
  • Phone Input
  • Popover
  • Progress
  • Progress Circle
  • Radio Group
  • Rating
  • Resizable
  • Responsive Dialog
  • Rich Text Editor
  • Scroll Area
  • Segmented Control
  • Select
  • Separator
  • Sheet
  • Sidebar
  • Signature
  • Skeleton
  • Slider
  • Sonner
  • Sortable
  • Spinner
  • Stat
  • Stepper
  • Switch
  • Table
  • Tabs
  • Tag Input
  • Terminal
  • Textarea
  • Time Field
  • Timeline
  • Toast
  • Toggle
  • Toggle Group
  • Tooltip
  • Tree
  • Typography
  • Video Player
  • Window Mockup
AI
  • Message Scroller
  • Message
  • Bubble
  • Marker
  • Attachment
  • Questionnaire
  • Composer
  • Reasoning
  • Tool Call
  • Approval Card
  • Citations
Blocks
  • Airtable
  • Airtable Kanban
  • ClickUp List
  • ClickUp Kanban
  • Repeatable Group
  • Command Palette
  • Sign In and Sign Up
  • Availability Scheduler
  • AI Chat
  • Action Bar
  • Notion
  • Banking
  • Lineup Builder
  • Sports Score
  • Strava
  • Sheets
  • Notices
  • Settings
  • Billing
Utilities
  • motion
  • sounds
  • scroll-fade
  • shimmer
Another UI. Built on shadcn/ui with Phosphor icons.

Password Strength

PreviousNext

A password field with a show and hide toggle, a segmented strength meter and a checklist of rules.

Base UIReact AriaRadix UI
Radix UI
StrengthWeak
  • At least 8 charactersdone
  • A numberdone
  • A symbolnot yet

Installation#

pnpm dlx shadcn@latest add https://anotherui.dev/r/password-strength.json

Usage#

import { PasswordInput, PasswordStrength, passwordStrength } from "@/components/ui/password-strength"
<PasswordStrength value={password} onValueChange={setPassword} />
 
<PasswordInput autoComplete="current-password" />

Scoring#

passwordStrength() gives a score from 0 to 4: one point each for 8 or more characters, 12 or more, mixed case, and a number plus a symbol. Scores of 0 and 1 are red, 2 is amber and 3 or more uses the primary color. It is exported, so a Meter elsewhere can share the same scoring.

Rules#

The checklist runs each rule against the password and swaps the circle for a bold check once it passes. The length rule defaults to 8 characters; set minLength to change it, for example <PasswordStrength minLength={12} />. Pass your own rules to replace the list, and use passwordRules(12).every((r) => r.test(value)) to block a form until they all pass.

Props#

  • PasswordStrength. value, defaultValue and onValueChange. minLength (default 8) sets the length rule and the scoring. rules, showMeter, showRules and meterLabel shape what sits under the field, and rulesClassName lays out the checklist. Everything else goes to the input.
  • PasswordInput. Any input prop, plus onValueChange, invalid and icon for the leading icon. The eye toggle swaps with the shared icon swap.
  • PasswordRules. password and rules, for a checklist on its own.
PaginationPhone Input

On This Page

InstallationUsageScoringRulesProps