# Reset password

- **[App UI](/app/)**
- **[Authentication](/app/auth/)**
- **Reset password**

Ask for a password reset link: one email field, a send button, a confirmation that does not reveal whether the address has an account, a resend button, and idle…

## Notes

- **When to use it**: A single-field page for asking for a password reset link. For entering an emailed code use `app-auth-code`; for a returning user with a password use `app-auth-signin`.
- **Writing for it**: - Write `messages.sent` (160 characters) so it does not say whether the address has an account, for example that a link is on its way if the address is registered.
- `emailHint` (120) is optional helper text under the field; use it for the address format or which address to use, not for instructions about the whole flow.
- The `back` link is the way out to the sign-in page. Give it a label that names the destination, since it is the only other control on the page.
- **Watch out for**: After the state becomes sent, the same button turns into the `resend` action and skips browser validation, and each press repeats the confirmation. `resend` is required, so an emptied label is not allowed even though it only appears in the sent state.

## Pairs well with

- **[App, sign in](/blocks/app/auth-signin)**
- **[App, one-time code](/blocks/app/auth-code)**
- **[App, sign up](/blocks/app/auth-signup)**

## Usage

The block in a page, with its default content (long lists shortened). Every prop is in the table below.

section.tsx

```
import { Theme } from '@/components/klarhimmel/theme/style';
import { BlockSurface } from '@/components/klarhimmel/blocks/surface';
import AppAuthReset from '@/components/klarhimmel/blocks/app-auth-reset';

export default function Section() {
  return (
    <Theme theme="brand">
      <BlockSurface>
        <AppAuthReset props={{
          "eyebrow": "Name the section",
          "title": "Say what this page is for",
          "description": "Say which address to enter and what will be sent to it.",
          "emailLabel": "Email address",
          "emailHint": "Say where the link goes.",
          "submit": "Send reset link",
          "sending": "Sending…",
          "resend": "Send it again",
          "back": {
            "label": "Back to sign in",
            "href": "#sign-in"
          },
          "state": "idle",
          "messages": {
            "sent": "Say that a link is on its way if the address has an account, and where to look.",
            "error": "Say that the email was not sent and to try again.",
            "emailError": "Say what a valid address looks like."
          }
        }} />
      </BlockSurface>
    </Theme>
  );
}
```

## Props

The email field and its hint are the content; state moves between idle, sending, sent and error. The sent message must not say whether the address has an account.

- **eyebrow**: Text, up to 60 characters. Optional; empty is not rendered.
- **title**: Text, up to 120 characters.
- **description**: Text, up to 300 characters. Optional; empty is not rendered.
- **emailLabel**: Text, up to 40 characters.
- **emailHint**: Text, up to 120 characters. Optional; empty is not rendered.
- **submit**: Text, up to 30 characters.
- **sending**: Text, up to 30 characters.
- **resend**: Text, up to 30 characters.
- **back**: See the type.
- **state**: One of 'idle', 'sending', 'sent', 'error'.
- **messages**: Fields: sent, error, emailError.
- **action**: Text, up to 300 characters. Optional; empty is not rendered.
- **method**: One of 'post', 'get'. Optional; empty is not rendered.
- **hidden**: Optional; empty is not rendered.
- **captcha**: Optional; empty is not rendered.
- **captchaSitekey**: Text, up to 100 characters. Optional; empty is not rendered.
- **headingLevel**: One of '1', '2'. Optional; empty is not rendered.

## Install

- **CLI**

  ```
  npx shadcn add @klarhimmel/app-auth-reset
  ```

Uses

- Banner
- Button
- Input
- TextLink

- **About**: Ask for a password reset link: one email field, a send button, a confirmation that does not reveal whether the address has an account, a resend button, and idle, sending, sent and error states.
- **States**: Idle, sending, sent, error. The confirmation does not reveal whether the address has an account. New project? Set it up once: /get-started/installation.
