Skip to content
weftGitHub

ResetPassword

Ask for a reset by email, then set a new password.

SourcePackage @weft-js/warp

Preview

tsx
import { state } from '@weft-js/core'import { AuthDone, MagicLinkSent, ResetPassword } from '@weft-js/warp'export function Steps() {  const stage = state<'request' | 'sent' | 'password' | 'done'>('request')  return (    <>      {stage.value === 'request' && <ResetPassword heading="h3" onSubmit={() => (stage.value = 'sent')} onBack={() => {}} />}      {stage.value === 'sent' && <MagicLinkSent heading="h3" title="Check your inbox" email="priya@weft.dev" lede="Press Resend link to stand in for the email." onResend={() => (stage.value = 'password')} resendIn={0} onChangeEmail={() => (stage.value = 'request')} />}      {stage.value === 'password' && <ResetPassword heading="h3" stage="password" onSubmit={() => (stage.value = 'done')} />}      {stage.value === 'done' && <AuthDone heading="h3" title="Password changed" lede="Use the new one next time." delay={2400} onContinue={() => (stage.value = 'request')} />}    </>  )}

Installation

npm install @weft-js/warp

Usage

tsx
import { ResetPassword } from '@weft-js/warp'

Accessibility

  • This has no shortcuts of its own: controls inside it use Tab, Enter and Space as usual, and warp's parts keep their roles and labels.

API Reference

PropTypeDefaultDescription
stage"request" | "password"—request asks for the email. password sets the new one.
titleunknown—The heading.
ledeunknown—One line under it.
formFormLike—What <Form of={mutation}> gives you. The screen then renders no form of its own.
errorsRecord<string, string>—Messages by field name.
errorunknown—The failure: a string, or a typed error it can map to the right place.
errorOptionsFlowErrorOptions—Words by error code.
pendingbooleanfalseShows progress on the submit button.
headingHeading—The title's level. An auth step is usually the whole page, so h1.
EventTypeDefaultDescription
onBack(() => void)—Shows Back.
onSubmit((values: ResetValues, e: SubmitEvent) => void)—Called with the values once the screen's own checks pass.
onRetry(() => void)—The Retry on a network failure's toast.

Parts

Every element carries a stable name, so you can style it from your own CSS: [data-scope="reset-password"] [data-part="lede"]

lede

RelatedMagic link sentPassword meter