Skip to main content

Overview

RequestCodeForm is a collection of components designed to facilitate the creation of a custom forgot password flow. It provides a set of components that encapsulate the business logic for handling the request code form, allowing users to easily customize the layout, styles, labels, placeholders, and button texts.

Example Usage

custom-request-code-form.tsx

RequestCodeForm.Root

The root component of request code form. It encapsulates business logic for handling code requesting process.
RequestCodeForm is responsible only for requesting code. You need to implement a UpdatePasswordForm (from ForgotPasswordElements) that handles password updating process.

Props

ReactNode
React elements to be rendered inside the form. RequestCodeForm elements should be rendered as children of RequestCodeForm.Root.
callback
required
A callback function that is called when code is successfully requested.
string
Default email value for the email input field.
string
required
Reset password url used to redirect user to reset password page from email. It should contain a placeholder for the reset password code.

RequestCodeForm.EmailInput

Field for email of user’s for which a password reset code will be requested.

Props

string
Label for input field. Optional, if not provided the label will not be rendered.
string
Placeholder for input field. Optional, if not provided the placeholder will not be rendered.
string
Custom class name for label.
string
Custom class name for input.

RequestCodeForm.ErrorMessage

Displays an error message if there is an error in the form submission.

Props

string
Custom class name for the error message.

RequestCodeForm.SubmitButton

Submit button for the form.

Props

string
Text to be displayed on the button.
string
Custom class name for the button.