EXAMPLE SCREENS
Sign up
Validation on submit across four fields, with the strength meter gating the button on the same score the user sees.
PREVIEW
SOURCE
import {
AuthShell, AuthCard, OAuthRow, PasswordField, RadioGroup, FieldError,
estimatePasswordStrength,
} from '@objectifthunes/whiteboard'
// The gate uses the same score the meter shows, so the rule is never invisible.
const strength = estimatePasswordStrength(password)
const errors = {
name: !name.trim() ? 'Tell us what to call you.' : null,
email: !email.includes('@') ? 'Enter a valid email address.' : null,
password: strength.score < 2 ? 'Pick something longer, at least 12 characters.' : null,
terms: !terms ? 'You must accept the terms to continue.' : null,
}
<PasswordField
label="Choose a password"
showStrength
value={password}
onChange={e => setPassword(e.target.value)}
autoComplete="new-password"
error={submitted ? errors.password : undefined}
/>
{/* Belongs to a checkbox, not to a Field. */}
<Checkbox label="I accept the terms" checked={terms} onChange={onTerms} />
<FieldError>{submitted ? errors.terms : null}</FieldError>NOTES
Validation runs on submit across all four fields at once, rather than nagging per keystroke. The strength meter gates the button on the same score the user can see, so the rule is never invisible.
Three providers, so OAuthRow stacks them instead of squeezing three onto one line. FieldError carries the terms message, which belongs to a checkbox rather than to a Field.