<SignUp /> component

The component renders a UI for signing up users. The functionality of the component is controlled by the instance settings you specify in your OneAuxilia Dashboard, such as sign-in and sign-up options and social connections. You can further customize your component by passing additional properties at the time of rendering.

Note

The and 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, OneAuxilia will redirect the user to the Home URL instead.

Properties

All props are optional.


appearance Appearance | undefined

Optional object to style your components. Will only affect OneAuxilia components and not Account Portal pages.


routing 'hash' | 'path' | 'virtual'

The routing strategy for your pages. Defaults to 'path' in Next.js and Remix applications. Defaults to hash for all other SDK's.


path string

The path where the component is mounted on when routing is set to path. It is ignored in hash- and virtual-based routing. For example: /sign-up.


signInUrl string

Full URL or path to the sign in page. Use this property to provide the target of the 'Sign In' link that's rendered. It's recommended to use the environment variable instead.


forceRedirectUrl? string

If provided, this URL will always be redirected to after the user signs up. Takes priority over deprecated props such as afterSignUpUrl and redirectUrl. It's recommended to use the environment variable instead.


fallbackRedirectUrl? string

The fallback URL to redirect to after the user signs up, if there's no redirect_url in the path already. Defaults to /. Takes priority over deprecated props such as afterSignUpUrl and redirectUrl. It's recommended to use the environment variable instead.


signInForceRedirectUrl? string

If provided, this URL will always be redirected to after the user signs in. Takes priority over deprecated props such as afterSignUpUrl and redirectUrl. It's recommended to use the environment variable instead.


signInFallbackRedirectUrl? string

The fallback URL to redirect to after the user signs in, if there's no redirect_url in the path already. Defaults to /. Takes priority over deprecated props such as afterSignUpUrl and redirectUrl. It's recommended to use the environment variable instead.


initialValues SignUpInitialValues

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

Usage with frameworks

The following example includes basic implementation of the component. You can use this as a starting point for your own implementation.

The following example demonstrates how you can use the component on a public page.

If you would like to create a dedicated /sign-up page in your Next.js application, check out the dedicated guide.

app/page.tsx
import { SignUp, useUser } from '@oneauxilia/nextjs'

export default function Home() {
  const { user } = useUser()

  if (!user) {
    return <SignUp />
  }

  return <div>Welcome!</div>
}

Usage with JavaScript

The following methods available on an instance of the OneAuxilia class are used to render and control the component:

  • mountSignUp()

  • unmountSignUp()

  • openSignUp()

  • closeSignUp()

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

mountSignUp()

Render the component to an HTML <div> element.

function mountSignUp(node: HTMLDivElement, props?: SignUpProps): void

mountSignUp() params


node HTMLDivElement

The <div> element used to render in the component


props? SignUpProps

The properties to pass to the component.

mountSignUp() usage

index.ts
import { OneAuxilia } from '@oneauxilia/oneauxilia-js'

// Initialize OneAuxilia with your OneAuxilia publishable key
const oneauxilia = new OneAuxilia('YOUR_PUBLISHABLE_KEY')
await oneauxilia.load()

document.getElementById('app').innerHTML = `
  <div id="sign-up"></div>
`

const signUpDiv = document.getElementById('sign-up')

oneauxilia.mountSignUp(signUpDiv)

unmountSignUp()

Unmount and run cleanup on an existing <SignUp /> component instance.

function unmountSignUp(node: HTMLDivElement): void

unmountSignUp() params


node HTMLDivElement

The container <div> element with a rendered <SignUp /> component instance

unmountSignUp() usage

index.ts
import { OneAuxilia } from '@oneauxilia/oneauxilia-js'

// Initialize OneAuxilia with your OneAuxilia publishable key
const oneauxilia = new OneAuxilia('YOUR_PUBLISHABLE_KEY')
await oneauxilia.load()

document.getElementById('app').innerHTML = `
  <div id="sign-up"></div>
`

const signUpDiv = document.getElementById('sign-up')

oneauxilia.mountSignUp(signUpDiv)

// ...

oneauxilia.unmountSignUp(signUpDiv)

openSignUp()

Opens the component as an overlay at the root of your HTML body element.

function openSignUp(props?: SignUpProps): void

openSignUp() params


props? SignUpProps

The properties to pass to the <SignUp /> component

mountSignUp() usage

index.ts
import { OneAuxilia } from '@oneauxilia/oneauxilia-js'

// Initialize OneAuxilia with your OneAuxilia publishable key
const oneauxilia = new OneAuxilia('YOUR_PUBLISHABLE_KEY')
await oneauxilia.load()

document.getElementById('app').innerHTML = `
  <div id="sign-up"></div>
`

const signUpDiv = document.getElementById('sign-up')

oneauxilia.mountSignUp(signUpDiv)

unmountSignUp()

Unmount and run cleanup on an existing <SignUp /> component instance.

function unmountSignUp(node: HTMLDivElement): void

unmountSignUp() params


node HTMLDivElement

The container element with a rendered <SignUp /> component instance

unmountSignUp() usage

index.ts
import { OneAuxilia } from '@oneauxilia/oneauxilia-js'

// Initialize OneAuxilia with your OneAuxilia publishable key
const oneauxilia = new OneAuxilia('YOUR_PUBLISHABLE_KEY')
await oneauxilia.load()

document.getElementById('app').innerHTML = `
  <div id="sign-up"></div>
`

const signUpDiv = document.getElementById('sign-up')

oneauxilia.mountSignUp(signUpDiv)

// ...

oneauxilia.unmountSignUp(signUpDiv)

openSignUp()

Opens the <SignUp /> component as an overlay at the root of your HTML body element.

function openSignUp(props?: SignUpProps): void

openSignUp() params


props? SignUpProps

The properties to pass to the <SignUp /> component

openSignUp() usage

index.ts
import { OneAuxilia } from '@oneauxilia/oneauxilia-js'

// Initialize OneAuxilia with your OneAuxilia publishable key
const oneauxilia = new OneAuxilia('YOUR_PUBLISHABLE_KEY')
await oneauxilia.load()

oneauxilia.openSignUp()

closeSignUp()

Closes the sign up overlay.

function closeSignUp(): void

closeSignUp() usage

index.ts
import { OneAuxilia } from '@oneauxilia/oneauxilia-js'

// Initialize OneAuxilia with your OneAuxilia publishable key
const oneauxilia = new OneAuxilia('YOUR_PUBLISHABLE_KEY')
await oneauxilia.load()

oneauxilia.openSignUp()

// ...

oneauxilia.closeSignUp()

Customization

To learn about how to customize OneAuxilia components, see the customization documentation.

Last updated