Components · Reference
Password field
Render a password field for sign-in or a new password.
Preview
Usage
tsx
import { FormBuilder, FormReact } from "@lucas-barake/effect-form-react";
import { PasswordField } from "@krak-stack/auth/password-field/react";
import { Effect, Layer, Schema } from "effect";
import { Atom } from "effect/reactivity";
const form = FormReact.make(
FormBuilder.empty.addField("password", Schema.String),
{
fields: { password: PasswordField },
runtime: Atom.runtime(Layer.empty),
mode: { validation: "onSubmit" },
onSubmit: () => Effect.void,
},
);
export const PasswordInput = ({ label }: { label: string }) => (
<form.Initialize defaultValues={{ password: "" }}>
<form.password autoComplete="new-password" label={label} required />
</form.Initialize>
);
Use current-password for sign-in and new-password when creating or changing a password. The React field plugs into Effect Form; the HTML field participates in a native form and uses effectcn and Effect UI Kit for accessible labels and errors.
An optional recovery action is available for current passwords only. In React, provide recovery.onClick; in Effect UI, handle the RecoveryRequested event. Keep submission and recovery behavior in the host. The HTML component does not store the password in its model or send it in an Effect UI message.
Installation
shell
bun add @krak-stack/auth