āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā ā š shadcn/directory/clerk/clerk-docs/reference/components/authentication/sign-up ā āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā
<SignUp /> component'
description: Clerk's <SignUp /> component renders a UI for signing up users.
sdk: astro, chrome-extension, expo, nextjs, nuxt, react, react-router, remix, tanstack-react-start, vue, js-frontend
{{ style: { maxWidth: '460px' } }}
The <SignUp /> component renders a UI for signing up users. The functionality of the <SignUp /> component is controlled by the instance settings you specify in the Clerk Dashboard, such as sign-in and sign-up options and social connections. You can further customize your <SignUp /> component by passing additional properties at the time of rendering.
[!NOTE] The
<SignUp/>and<SignIn/>components cannot render when a user is already signed in, unless the application allows multiple sessions. If a user is already signed in and the application only allows a single session, Clerk will redirect the user to the Home URL instead.
<If sdk={["astro", "chrome-extension", "expo", "nextjs", "nuxt", "react", "react-router", "remix", "tanstack-react-start", "vue"]}
The following example includes basic implementation of the <SignUp /> component. You can use this as a starting point for your own implementation.
```tsx {{ filename: 'app/page.tsx' }}
'use client'
import { SignUp, useUser } from '@clerk/nextjs'
export default function Home() {
const { isSignedIn } = useUser()
if (!isSignedIn) {
return <SignUp />
}
return <div>Welcome!</div>
}
```
</If>
<If sdk="astro">
```astro {{ filename: 'pages/signup.astro' }}
---
import { SignUp } from '@clerk/astro/components'
---
<SignUp />
```
</If>
<If sdk="expo">
<Include src="_partials/expo/web-only-callout" />
```jsx {{ filename: '/app/sign-up.web.tsx' }}
import { SignUp } from '@clerk/clerk-expo/web'
export default function SignUpPage() {
return <SignUp />
}
```
</If>
<If sdk="react">
```jsx {{ filename: 'src/App.tsx' }}
import { SignUp } from '@clerk/clerk-react'
function App() {
return <SignUp />
}
export default App
```
</If>
<If sdk="react-router">
If you would like to create a dedicated `/sign-up` page in your React Router application, there are a few requirements you must follow. See the [dedicated guide](/docs/react-router/guides/development/custom-sign-up-page) for more information.
```tsx {{ filename: 'app/routes/sign-up.tsx' }}
import { SignUp } from '@clerk/react-router'
export default function SignUpPage() {
return <SignUp />
}
```
</If>
<If sdk="chrome-extension">
```jsx {{ filename: 'src/routes/sign-up.tsx' }}
import { SignUp } from '@clerk/chrome-extension'
export default function SignUpPage() {
return <SignUp />
}
```
</If>
<If sdk="remix">
If you would like to create a dedicated `/sign-up` page in your Remix application, there are a few requirements you must follow. See the [dedicated guide](/docs/remix/guides/development/custom-sign-up-page) for more information.
```tsx {{ filename: 'app/routes/sign-up.$.tsx' }}
import { SignUp } from '@clerk/remix'
export default function SignUpPage() {
return <SignUp />
}
```
</If>
<If sdk="tanstack-react-start">
If you would like to create a dedicated `/sign-up` page in your Tanstack React Start application, there are a few requirements you must follow. See the [dedicated guide](/docs/tanstack-react-start/guides/development/custom-sign-up-page) for more information.
```tsx {{ filename: 'app/routes/sign-up.$.tsx' }}
import { SignUp } from '@clerk/tanstack-react-start'
import { createFileRoute } from '@tanstack/react-router'
export const Route = createFileRoute('/sign-up')({
component: SignUpPage,
})
function SignUpPage() {
return <SignUp />
}
```
</If>
<If sdk="vue">
```vue {{ filename: 'sign-up.vue' }}
<script setup lang="ts">
import { SignUp } from '@clerk/vue'
</script>
<template>
<SignUp />
</template>
```
</If>
<If sdk="nuxt">
```vue {{ filename: 'sign-up.vue' }}
<script setup lang="ts">
// Components are automatically imported
</script>
<template>
<SignUp />
</template>
```
</If>
</If>
<If sdk="js-frontend">
## Usage with JavaScript
The following methods available on an instance of the Clerk class are used to render and control the <SignUp /> component:
The following examples assume that you have followed the quickstart in order to add Clerk to your JavaScript application.
mountSignUp()Render the <SignUp /> component to an HTML <div> element.
function mountSignUp(node: HTMLDivElement, props?: SignUpProps): void
mountSignUp() paramsThe `<div>` element used to render in the `<SignUp />` component
---
- `props?`
- [`SignUpProps`](#properties)
The properties to pass to the `<SignUp />` component.
</Properties>
mountSignUp() usageimport { 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()
document.getElementById('app').innerHTML = `
<div id="sign-up"></div>
`
const signUpDiv = document.getElementById('sign-up')
clerk.mountSignUp(signUpDiv)
unmountSignUp()Unmount and run cleanup on an existing <SignUp /> component instance.
function unmountSignUp(node: HTMLDivElement): void
unmountSignUp() paramsThe container `<div>` element with a rendered `<SignUp />` component instance
</Properties>
unmountSignUp() usageimport { 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()
document.getElementById('app').innerHTML = `
<div id="sign-up"></div>
`
const signUpDiv = document.getElementById('sign-up')
clerk.mountSignUp(signUpDiv)
// ...
clerk.unmountSignUp(signUpDiv)
openSignUp()Opens the <SignUp /> component as an overlay at the root of your HTML body element.
function openSignUp(props?: SignUpProps): void
openSignUp() paramsThe properties to pass to the `<SignUp />` component
</Properties>
openSignUp() usageimport { 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()
clerk.openSignUp()
closeSignUp()Closes the sign up overlay.
function closeSignUp(): void
closeSignUp() usageimport { 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()
clerk.openSignUp()
// ...
clerk.closeSignUp()
</If>
All props are optional.
<Properties> - `appearance` - <code>[Appearance](/docs/guides/customizing-clerk/appearance-prop/overview) | undefined</code>Optional object to style your components. Will only affect Clerk components and not Account Portal pages.
fallbackReactNodeAn optional element to be rendered while the component is mounting.
fallbackRedirectUrlstringThe 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.
forceRedirectUrlstringIf provided, this URL will always be used as the redirect destination after the user signs up. It's recommended to use the environment variable instead.
initialValuesSignUpInitialValuesThe values used to prefill the sign-up fields with.
oauthFlow"redirect" | "popup" | "auto"Determines how OAuth authentication is performed. Accepts the following properties:
"redirect": Redirect to the OAuth provider on the current page."popup": Open a popup window."auto": Choose the best method based on whether the current domain typically requires the "popup" flow to correctly perform authentication.Defaults to "auto".
pathstringThe path where the component is mounted on when routing is set to path. It is ignored in hash-based routing. For example: /sign-up.
routing'hash' | 'path'The routing strategy for your pages. Defaults to 'path' for frameworks that handle routing, such as Next.js and Remix. Defaults to hash for all other SDK's, such as React.
signInFallbackRedirectUrlstringThe fallback URL to redirect to after the user signs in, if there's no redirect_url in the path already. Used for the 'Already have an account? Sign in' link that's rendered. Defaults to /. It's recommended to use the environment variable instead.
signInForceRedirectUrl?stringIf provided, this URL will always be redirected to after the user signs in. Used for the 'Already have an account? Sign in' link that's rendered. It's recommended to use the environment variable instead.
signInUrlstringThe full URL or path to the sign-in page. Used for the 'Already have an account? Sign in' link that's rendered. It's recommended to use the environment variable instead.
unsafeMetadataSignUpUnsafeMetadataMetadata that can be read and set from the frontend and the backend. Once the sign-up is complete, the value of this field will be automatically copied to the created user's unsafe metadata (User.unsafeMetadata). One common use case is to collect custom information about the user during the sign-up process and store it in this property. Read more about unsafe metadata.
</Properties>
To learn about how to customize Clerk components, see the customization documentation.
If Clerk's prebuilt components don't meet your specific needs or if you require more control over the logic, you can rebuild the existing Clerk flows using the Clerk API. For more information, see the custom flow guides.
ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā