Text4 checks

FormPassword

Show toggle and an optional strength meter.

Example
Password strength
Installation
bunx --bun shadcn@latest add @fieldkit/form-password

Needs the @fieldkit registry. Add it once

Usage
  1. 1

    Add the field to your schema

    schema.ts
    import { z } from "zod"import { passwordField } from "@/lib/field-schemas"
    export const schema = z.object({  password: passwordField({ minScore: 3 }),})
  2. 2

    Render it inside a Form

    The name prop matches the schema key.

    example-form.tsx
    import { Form } from "@/components/form/form"import { FormPassword } from "@/components/form/form-password"import { FormSubmit } from "@/components/form/form-submit"import { FieldGroup } from "@/components/ui/field"import { schema } from "./schema"
    export function ExampleForm() {  return (    <Form      schema={schema}      defaultValues={{ password: "" }}      onSubmit={save}    >      <FieldGroup>        <FormPassword name="password" />        <FormSubmit>Save</FormSubmit>      </FieldGroup>    </Form>  )}
Checks
LengthminUse at least 8 characters
Letters and numbersdefaultAdd an uppercase letter
Strength scoreminScoreAdd another word or a few symbols
Confirm matchesrefine on the objectPasswords do not match
Best practices
  • Allow paste and password managers
  • Call loadPasswordScorer() before parsing on the server when you use minScore
Try these values
Terminal
passwordField()
InputResultOutput
"Kijani2026"Valid"Kijani2026"
"kijani2026"Invalid
Add an uppercase letter
"Kijani"Invalid
Add a numberUse at least 8 characters
"abcdefgh"Invalid
Add an uppercase letterAdd a number
API reference

FormPassword

strengthbooleanShows the meter. On by default when the schema sets minScore.
labelActionReact.ReactNodeShows next to the label, like a Forgot password? link.

Field frame

namestringKey in the schema. Also picks the preset label and autocomplete.
labelReact.ReactNodeOverrides the preset label. Pass null to hide it.
descriptionReact.ReactNodeHint under the control.
requiredbooleanOverrides the asterisk read from the schema.
fieldPropsFormFieldPropsProps for the wrapping Field, such as className.

Search docs

Find a component, input or example