Skip to main content
Docs

<RedirectToSignUp />

The <RedirectToSignUp /> component will navigate to the sign up URL which has been configured in your application instance. The behavior will be just like a server-side (3xx) redirect, and will override the current location in the history stack.

Usage with JavaScript

The following method available on an instance of the Clerk class is used to render and control the <RedirectToSignUp /> component:

The following examples assume that you have followed the quickstart in order to add Clerk to your JavaScript application.

redirectToSignUp()

Render the <RedirectToSignUp /> component to an HTML <div> element.

function redirectToSignIn(options?: SignUpRedirectOptions): Promise<unknown>
  • Name
    options?
    Type
    SignUpRedirectOptions | undefined
    Description

    Options to use in the redirect, such as signUpForceRedirectUrl and signUpFallbackRedirectUrl.

main.js
import { Clerk } from '@clerk/clerk-js'

// Initialize Clerk with your Clerk Publishable Key
const clerkPubKey = import.meta.env.VITE_CLERK_PUBLISHABLE_KEY

const clerk = new Clerk(clerkPubKey)
await clerk.load()

await clerk.redirectToSignUp({
  signUpForceRedirectUrl: '/dashboard',
  signUpFallbackRedirectUrl: '/dashboard',
})
  • Name
    signUpFallbackRedirectUrl?
    Type
    string
    Description

    The fallback URL to redirect to after the user signs up, if there's no redirect_url in the path already. Defaults to /. It's recommended to use the environment variable instead.

  • Name
    signUpForceRedirectUrl?
    Type
    string
    Description

    If provided, this URL will always be redirected to after the user signs up. It's recommended to use the environment variable instead.

  • Name
    initialValues
    Type
    SignUpInitialValues
    Description

    The values used to prefill the sign-up fields with.

Feedback

What did you think of this content?

Last updated on