Skip to main content

Overview

ProfileForm is a collection of components designed to facilitate the creation of a custom user details page. It provides a set of components that encapsulate the business logic for handling the user details form, allowing users to easily customize the layout, styles, labels, placeholders, and button texts.
ProfileForm should be used in protected page - user should be authenticated to access it.

Example Usage

custom-profile-form.tsx

ProfileForm.Root

The root component of profile form. Encapsulates the business logic for handling user details form.

Props

ReactNode
React elements to be rendered inside the form. ProfileForm elements should be rendered as children of ProfileForm.Root.
UserDetails
required
User details to be pre-filled in the form.
UserDetails type

Input Fields

ProfileForm has the following exported input fields:
  • ProfileForm.FirstNameInput - field for entering first name.
  • ProfileForm.LastNameInput - field for entering last name.
  • ProfileForm.PhoneNumberInput - field for entering phone number.
All these fields have similar props listed below:

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.

ProfileForm.ErrorMessage

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

Props

string
Custom class name for the error message.

ProfileForm.SubmitButton

Submit button for the form.

Props

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