Skip to main content
Docs

<SignInButton>

The <SignInButton> component is a button that, by default, links to your app's sign-in page. Your sign-in page will be hosted by Clerk using the Account Portal unless you have set up a dedicated sign-in page.

Usage

Basic usage

pages/sign-in.astro
---
import { SignInButton } from '@clerk/astro/components'
---

<SignInButton />

Custom usage

You can create a custom button by wrapping your own button, or button text, in the <SignInButton> component.

You must pass the asChild prop to the <SignInButton> component if you are passing children to it.

pages/index.astro
---
import { SignInButton } from '@clerk/astro/components'
---

<SignInButton asChild>
  <button>Custom sign in button</button>
</SignInButton>
  • Name
    forceRedirectUrl?
    Type
    string
    Description

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

  • Name
    fallbackRedirectUrl?
    Type
    string
    Description

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

  • Name
    oauthFlow
    Type
    "redirect" | "popup" | "auto"
    Description

    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".

  • 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
    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
    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.

  • Name
    initialValues
    Type
    Description

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

  • Name
    asChild?
    Type
    boolean
    Description

    If true, the <SignInButton> component will render its children as a child of the component.

Feedback

What did you think of this content?

Last updated on