SwipeUI

Password strength

A local meter of length and character hints with an optional application estimator.

npx @swipeui/cli add password-strength
Variant
Preset
Material
Scheme
Feel
Real free component with a browser animation bridge. Native motion, haptics and materials need a device.

When to use it

  • Sign-up and change-password screens, to guide people toward a stronger password.
  • Showing which simple rules are still missing, such as a number or a symbol.
  • Plugging in your own estimator, such as zxcvbn, while keeping the same meter.

When not to use it

  • Sign-in screens; don't judge an existing password.
  • Enforcing security policy. Validate on the server.
  • Claiming a password is secure; the built-in hints only check simple rules.

Installation

Run this from your app's root. If SwipeUI isn't set up yet, run npx @swipeui/cli init first; it sets up Uniwind, the theme tokens and the cn helper.

npx @swipeui/cli add password-strength
  • Adds components/swipeui/ui/password-strength.tsx and 4 shared helpers.
  • Installs react-native-reanimated, uniwind, react-native-worklets, clsx, tailwind-merge, class-variance-authority. In Expo apps it uses npx expo install so versions match your SDK.

Usage

app/sign-up.tsx
import { PasswordStrength } from '@/components/swipeui/ui/password-strength';

<PasswordStrength value={password} />;

Examples

Use the variant and appearance controls in the live specimen to compare the documented states. The application owns validation, operation results and persistence.

API reference

PasswordStrengthProps

PropTypeDefaultDescription
valuestring—

Password evaluated in memory; never sent or logged.

minLength?number12

Minimum-length hint.

evaluate?((value: string) => PasswordStrengthResult)—

Optional application estimator, called locally.

segments?number4

Number of hint segments.

completionEffect?booleantrue

One rainbow pulse across all the bars when every hint is met: the bars lift in turn and pass red, amber, green and blue along the row before settling green. Reduce Motion keeps them still.

showHints?booleantrue

Keep the hint checklist visible.

hintAnimation?booleantrue

Pop each hint when met.

hintCompletionEffect?booleanfalse

Diagonal rainbow text sweep over the hints when every hint is met. Off by default, so the pulse stays on the bars.

motion?MotionOverridethe app feel

Shared selection motion.

className?string—

Root classes.

style?StyleProp<ViewStyle>—

Native style escape hatch.

testID?string—

Root test identifier.

Native view/input props not listed here pass through where the exported TypeScript type allows them.

Composition and behavior

  • value is the password to check. minLength sets the length hint (12).
  • The built-in hints check length, mixed case, a number and a symbol.
  • evaluate replaces them with your own score and hints.

Password strength settings

The meter uses one segment per configured hint. One completed segment is red, two are amber, and three or more are green. Meeting every hint plays one rainbow pulse across all the bars: they lift in turn and pass red, amber, green and blue along the row, then settle green. This is guidance, not an entropy estimate.

PropDoesDefault
segmentsNumber of hint bars; match custom estimators to this count4
completionEffectOne rainbow pulse across the bars (still under Reduce Motion)true
minLengthMinimum-length hint12

Hints remain visible in a centered card; met rules pop and settle. With hintCompletionEffect on, completion also sends a diagonal colour sweep through their text.

PropDoesDefault
showHintsShow the persistent hint cardtrue
hintAnimationPop newly met hintstrue
hintCompletionEffectDiagonal completion rainbow on hint textfalse

Behavior and gestures

  • It updates as people type, filling up to four segments.
  • Hints remain visible as a checklist; met rules pop and settle, such as "Use at least 12 characters" or "Add a symbol".
  • It doesn't respond to touch.

Accessibility

  • Announced as a progress bar called "Password hints" with a value like "2 of 4 hints met".
  • Hints are text, not just colour.
  • The password is checked in memory and is never sent or logged.

Motion

  • Uses the select motion role, so it follows your app's feel. Pass motion to tune this one instance.
  • Segments fill with the select spring.
  • Reduce Motion fills them instantly.

Performance

  • The built-in check is four quick tests; heavy estimators should be memoised in your app.

Notes for AI

  • Pass evaluate to use your own estimator; scores are clamped to 0–4.

Compatibility

Runs onSupported
Expo SDK 57Yes
Expo SDK 58Yes
React Native CLI (with Expo modules)Yes
Expo GoYes
iOSYes
AndroidYes

This table describes API support and static bundle checks. Native runtime, device accessibility and bare Uniwind compatibility remain pending.

Related items