<SignUp />

A beautiful, high-conversion sign-up flow with your choice of required fields and social sign-up providers.

Overview

The <SignUp/> component is used to render a beautiful, high-conversion sign-up flow with your choice of required fields and social sign-up providers. It supports any authentication scheme, from basic email/password authentication, to passwordless and social login (OAuth) and it automatically handles everything for you, from basic data collection to email address and phone number verification.

The <SignUp/> component is extremely flexible. Simply configure the User Management settings of your instance according to your business requirements and the <SignUp/> .

Control the look and feel of the <SignUp/> component and match it to your using the Theme Settings, theming props or plain CSS.

Usage

Make sure you've followed the installation guide for Clerk React or ClerkJS before running the snippets below.

Mounting in your app

Once you set up the desired functionality and look and feel for the <SignIn/> component, all that's left is to render it inside your page. The default rendering is simple but powerful enough to cover most use-cases. The authentication and display (look and feel) configuration that you've set up in your Clerk Dashboard will work out of the box.

Clerk React
ClerkJS
Clerk React
import { ClerkProvider, SignUp } from '@clerk/clerk-react';
import { useHistory } from 'react-router-dom';
function MySignUpPage() {
// Render the SignUp component
// somewhere in your app
return <SignUp />;
}
function App() {
return (
// Your app needs to be wrapped with ClerkProvider
<ClerkProvider frontendApi={"[your-frontend-api]"}>
<MySignUpPage />
</ClerkProvider>
);
}
export default App;
ClerkJS
<html>
<body>
<div id="sign-up"></div>
<script>
const el = document.getElementById("sign-up");
// Mount the pre-built Clerk SignUp component
// in an HTMLElement on your page.
window.Clerk.mountSignUp(el);
</script>
</body>
</html>

Using path-based routing

The mounted <SignUp/> component uses hash-based routing by default: as the user goes through the sign up flow, hash portion of the URL will update to reflect the current step (eg: example.com/#/verify-email).

With additional configuration, the mounted component can use path-based routing instead (eg: example.com/sign-up/verify-email):

  1. If using Clerk React, ensure your ClerkProvider component has its navigate prop configured.

  2. Add the path and routing props to your SignUp component. Set path to the path where the component renders

When using path-based routing, the <SignUp/> component must render on path and all of it's subpaths:

Clerk React
Clerk Next
ClerkJS
Clerk React
import { ClerkProvider, SignUp } from '@clerk/clerk-react';
import { useHistory } from 'react-router-dom';
function App() {
// Get the navigate/push method from
// the router your app is using. For this
// example we will use 'react-router-dom'
const { push } = useHistory();
return (
// Pass the push method to ClerkProvider
<ClerkProvider
frontendApi={"[your-frontend-api]"}
navigate={to => push(to)}
>
<Switch>
// Declare a /sign-up route
<Route path='/sign-up'>
// Finally, mount the SignUp component under "/sign-up" 🎉
// Don't forget to set the "routing" and "path" props
<SignUp routing='path' path='/sign-up' />
</Route>
</Switch>
</ClerkProvider>
);
}
export default App;
Clerk Next
// In _app.js:
// Your usual NextJS root component, wrapped by ClerkProvider
import '../styles/globals.css';
import { ClerkProvider } from '@clerk/clerk-react';
import { useRouter } from 'next/router';
function MyApp({ Component, pageProps }) {
// Get the navigate/push method from
// the NextJS router
const { push } = useRouter();
return (
// Pass the push method to ClerkProvider
<ClerkProvider
frontendApi={clerkFrontendApi}
navigate={to => push(to)}
>
<Component {...pageProps} />
</ClerkProvider>
);
}
export default MyApp;
// In pages/sign-up/[[..index]].tsx
// This is your catch all route that renders the SignUp component
import { SignUp } from '@clerk/clerk-react';
export default function SignUpPage() {
// Finally, mount the SignUp component under "/sign-up" 🎉
// Don't forget to set the "routing" and "path" props
return <SignUp routing='path' path='/sign-up' />;
}
ClerkJS
<html>
<body>
<div id="sign-up"></div>
<script>
const el = document.getElementById("sign-up");
// Mount the pre-built Clerk SignUp component
// in an HTMLElement on your page.
window.Clerk.mountSignUp(el, {
routing: 'path',
path: '/sign-up',
});
</script>
</body>
</html>

For more information, see Routing.

Presenting as a modal

The <SignUp/> component can also be presented as a modal. This is typically used on pages that show content whether or not the user is signed in.

Clerk React
ClerkJS
Clerk React
import { useClerk } from "@clerk/clerk-react";
const SignUpButton = () => {
const { openSignUp } = useClerk();
return <button onClick={openSignUp}>Sign up</button>;
};
ClerkJS
<html>
<body>
<button id="open-sign-up">Open sign up</button>
<script>
// Calling the openSignUp method will
// open the SignUp component as a modal
// and show the hosted Sign Up page
const btn = document.getElementById('open-sign-up');
btn.addEventListener('click', () => {
window.Clerk.openSignUp();
});
</script>
</body>
</html>

Props

Name

Description

routing?

RoutingStrategy

The routing strategy for your pages. Supported values are:

  • hash: (default) Hash based routing.

  • path: Path based routing.

  • virtual: Virtual based routing.

path?

string

The root URL where the component is mounted on.

afterSignUpUrl?

string

The full URL or path to navigate after a successful sign up.

signInUrl?

string

Full URL or path to the sign up page. Use this property to provide the target of the "Sign In" link that's rendered at the bottom of the component.

Customization

The <SignUp/> component can be highly customized through the Instance settings in the Clerk Dashboard. This document will be updated soon with all necessary details.