Sign-in button
The package ships no UI. The example app has a "Sign in with Google" button styled to Google's branding guidelines, built from NitroUI views on top of signInWithGoogle.
theme
text
shape
<GoogleSignInButton theme="light" text="signIn" shape="pill" />Copy it into your app
Copy two files from the example:
<GoogleSignInButton
theme="dark" // light, dark or neutral
text="continue" // signIn, signUp or continue
shape="pill" // pill or rectangular
onSignIn={(session) => sendToBackend(session.idToken)}
onCancel={() => {}}
onError={(error) => showError(getGoogleSignInErrorCode(error))}
/>
Call GoogleSignIn.configure() before the first tap. The button ignores taps while sign-in runs, so a double tap never rejects with IN_PROGRESS.
Props
| Prop | Type | Default | Description |
|---|---|---|---|
onSignIn | (session: GoogleSession) => void | required | Receives the session after a successful sign-in. |
onCancel | () => void | Called when the user closes Google's sheet. | |
onError | (error: unknown) => void | Receives sign-in failures; read the code with getGoogleSignInErrorCode. Left out, failures reject unhandled. | |
text | 'signIn' | 'signUp' | 'continue' | 'signIn' | The label: "Sign in with Google", "Sign up with Google" or "Continue with Google". |
theme | 'light' | 'dark' | 'neutral' | 'light' | Button colors from Google's branding guidelines. |
shape | 'pill' | 'rectangular' | 'pill' | Corner radius 20 or 4. |
disabled | boolean | false | Dims the button and ignores taps. |
layout | ViewProps['layout'] | Outer layout such as margins or width; the button keeps its own height and padding. |