Skip to main content

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.

Sign in with Google
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​

PropTypeDefaultDescription
onSignIn(session: GoogleSession) => voidrequiredReceives the session after a successful sign-in.
onCancel() => voidCalled when the user closes Google's sheet.
onError(error: unknown) => voidReceives 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.
disabledbooleanfalseDims the button and ignores taps.
layoutViewProps['layout']Outer layout such as margins or width; the button keeps its own height and padding.