Email + password

The <SignUpForm /> will create a new user in your database and create a session for them. Uses simple <Email /> and <Password /> fields, along with the useSignUp() hook. In most cases, you want to supply a callbackUrl, which is where the user will be redirected upon successful sign up and sign in.

Error handling

In the case of errors from the API, or you want to do something more custom with the response, you can use the onError and onSuccess callbacks. Note that redirect is set to the current page by default, so you may want to set it to false if you want to handle the redirect yourself - especially if you want to display a custom error message.

export default function SignUpPage() {
  const [error, setError] = error('')
  return (
    {error && (
          <div className="bg-red-100 border border-red-400 text-red-700 px-4 py-3 rounded mb-4">
            {error}
          </div>
    )}
      <SignUpForm
        redirect={false}
        onError={(e) => {
          setError(e.message);
        }}
        onSuccess={(data) => {
          console.log(data); // do something with the data
          router.push("/"); // redirect to a new page
        }}
      />
  )
}

Custom sign up form