Customize
Installation
Installs are paused for now. You can still preview and customize every component on its page.
Usage
import { AuthButton } from "@/components/auth-button";
<AuthButton provider="google" onClick={handleGoogleSignIn} />
<AuthButton provider="github" intent="signup" />
<AuthButton provider="chatgpt" size="lg" className="w-full" />The label reads "Sign in with Google" or "Sign up with GitHub", based on intent and the provider. Pass children to write your own.
Each button sits on a frosted surface with a faint tint of the brand's colors. It moves down 1px when clicked, like a normal button press.
Providers
Google, GitHub, Microsoft, ChatGPT, Discord, Spotify, GitLab, LinkedIn, Slack, Twitch, Notion and Dropbox. Black logos like GitHub and ChatGPT turn white in dark mode.
Connecting your auth
The button doesn't sign anyone in by itself. Call your auth library in onClick:
// Auth.js (NextAuth)
import { signIn } from "next-auth/react";
<AuthButton provider="github" onClick={() => signIn("github")} />// Better Auth
<AuthButton
provider="google"
onClick={() => authClient.signIn.social({ provider: "google" })}
/>// Supabase
<AuthButton
provider="discord"
onClick={() => supabase.auth.signInWithOAuth({ provider: "discord" })}
/>Set disabled while sign-in is running to stop double clicks.
Custom brand
Pass an object instead of a provider name:
import { AuthButton, type AuthBrand } from "@/components/auth-button";
const brand: AuthBrand = {
name: "Acme",
logo: "/acme-logo.svg",
colors: ["#3aad65", "#e5d36a"],
};
<AuthButton provider={brand} />namegoes in the label.logois any image URL, path or SVG data URL.colorssets the tint. Leave it out for a plain button.mono: trueturns a black logo white in dark mode.
If the logo fails to load, the first letter of the name shows instead.
Themes
It follows light and dark mode through the dark class. The focus outline uses your --ring color. The click effect is turned off when reduced motion is on.
Props
One of the 12 built-in providers, or your own brand object.
"google"Shows Sign in with or Sign up with.
"signin"36px, 44px or 48px tall.
"default"Fades the button and stops clicks.
falseReplaces the built-in label.
"button"Use w-full to fill the available width.