Docs

You are viewing an archived version of the docs.Go to latest version

<SignInButton>

The <SignInButton> component is a button that links to the sign-in page or displays the sign-in modal.

<SignInButton> properties

  • Name
    redirectUrl?
    Type
    string
    Description

    Full URL or path to navigate after successful sign in or sign up.
    The same as setting afterSignInUrl and afterSignUpUrl to the same value.

  • Name
    afterSignInUrl?
    Type
    string
    Description

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

  • Name
    afterSignUpUrl?
    Type
    string
    Description

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

  • Name
    mode?
    Type
    'redirect' | 'modal'
    Description

    Determines what happens when a user clicks on the <SignInButton>. Setting this to 'redirect' will redirect the user to the sign-in route. Setting this to 'modal' will open a modal on the current route.
    Defaults to 'redirect'

  • Name
    children?
    Type
    React.ReactNode
    Description

    Children you want to wrap the <SignInButton> in.

pages/index.js
import { SignInButton } from "@clerk/nextjs";

export default function Home() {
  return (
    <div>
      <SignInButton />
    </div>
  );
}
example.js
import { SignInButton } from "@clerk/clerk-react";

export default function Example() {
  return (
    <div>
      <SignInButton />
    </div>
  );
}
pages/index.js
import { SignInButton } from "@clerk/remix";

export default function Home() {
  return (
    <div>
      <SignInButton />
    </div>
  );
}
pages/index.js
import { SignInButton } from "gatsby-plugin-clerk";

export default function Home() {
  return (
    <div>
      <SignInButton />
    </div>
  );
}

Custom usage

In some cases, you will want to use your own button, or button text. You can do that by wrapping your button in the <SignInButton> component.

pages/index.js
import { SignInButton } from "@clerk/nextjs";

export default function Home() {
  return (
    <div>
      <SignInButton>
        <button>Sign in with Clerk</button>
      </SignInButton>
    </div>
  );
}
example.js
import { SignInButton } from "@clerk/clerk-react";

export default function Example() {
  return (
    <div>
      <SignInButton>
        <button>Sign in with Clerk</button>
      </SignInButton>
    </div>
  );
}
pages/index.js
import { SignInButton } from "@clerk/remix";

export default function Home() {
  return (
    <div>
      <SignInButton>
        <button>Sign in with Clerk</button>
      </SignInButton>
    </div>
  );
}
pages/index.js
import { SignInButton } from "gatsby-plugin-clerk";

export default function Home() {
  return (
    <div>
      <SignInButton>
        <button>Sign in with Clerk</button>
      </SignInButton>
    </div>
  );
}

Feedback

What did you think of this content?

Last updated on