Social Sign-in Buttons
FreeSign-in buttons for Google, Apple, GitHub and Microsoft, side by side or stacked, each with the provider's mark and a label. A press reports the provider; nothing is called for you.
npx wunderui-cli add social-sign-in-buttonsPlayground
Installation
npx wunderui-cli add social-sign-in-buttonsWrites the source into your project with its dependencies and, on first use, the styles - see Installation.
Then import what you need:
import { SocialSignInButtons } from "@/components/blocks/auth"Then use it:
import { SocialSignInButtons } from "@wunderui/react"
export function SignInProviders() {
return (
<SocialSignInButtons
providers={["google", "github"]}
onSelect={(provider) => console.log("Sign in with", provider)}
/>
)
}Expected result: You see two white buttons side by side on a wide screen, Continue with Google and Continue with GitHub, each with its logo. Pressing one logs the provider.
When to use
Use Social Sign-in Buttons for
- A sign-in or sign-up card that offers an account at Google, Apple, GitHub or Microsoft
- A social-first screen where the providers come before the email form
- A row of providers on an invitation or onboarding page
Use something else for
- Button for any action that is not the choice of a provider, such as Sign in with email
- Divider with Label for the or between the providers and an email form
- Text Link Row for a line that leads to the other screen, such as Sign up
Providers
The providers list sets the buttons in the order you give: Google, Apple, GitHub and Microsoft. Each has its own mark, and Google and Microsoft keep their brand colours.
Label
Every label is a prefix plus the provider name. Continue with is the default; use Sign in with, Sign up with or an empty prefix for the icon and name alone.
Layout
Horizontal puts the buttons in one row from 640 px of window width and stacks them below; vertical always stacks. A label is never cut, so give each button room or stack them.
States
The buttons have no disabled, pending or error state. A disabled fieldset turns them all off and dims them, and a status line next to them says what is happening or what went wrong.
State
Google sign-in was cancelled. Try again or use your email address.
Keyboard interactions
The component handles no keys itself. Every provider is a native button and a tab stop, in the order you list them, with no arrow key navigation between them.
- TaborShift+Tab
- Moves focus to the next or the previous provider, and out of the group after the last one. A button inside a disabled fieldset is skipped.
- Enter
- Presses the focused button and calls with the provider.
- Space
- Presses the focused button, on release of the key, like any button.
Behavior and motion
What the buttons do with their label and width, and what they leave to you.
- Providers
- The providers list sets the buttons in the order you give it, Google and GitHub by default. Each provider can appear once, and an empty list renders an empty grid.
- Layout and width
- Horizontal stacks below 640 px and sits in one row above, by window width, not container width. In a narrow container on a wide window use vertical or fewer providers.
- Label
- The label is the prefix plus the provider name, like Continue with Google, or the name alone with an empty prefix. It stays on one line and runs out of a too-narrow column.
- Press
- A press reports google, apple, github or microsoft. The component starts no sign-in, keeps no state and shows no pending or selected button, and it never submits a surrounding form.
- States
- The buttons are plain Buttons: hover tints the fill, a press scales down a little, focus shows the ring. For a disabled state wrap them in a disabled fieldset, which dims them to 40 %.
- Semantics
- The grid has no role or name, and each button is named by its label. To name the group wrap the buttons in a labelled group, and put a pending or failed status in an always-mounted status element.
- Where it is used
- The split sign-in, centred sign-in, split sign-up, sign-up with password rules and social-first sign-up blocks use it.
- Motion and reduced motion
- Fill and border change quickly, and a press scales the button to 97 %. With reduced motion the scale is off and only the colour changes.
Anatomy
The figure shows two providers side by side. The label is the button's text and has no element of its own.
- 1data-slot="social-sign-in"
A grid with a 12 px gap: horizontal is one column below 640 px window width and one row of equal columns above, vertical is always one column. It has no border, background or role.
- 2
One plain, rounded large Button per provider, as wide as its column. The label is the prefix plus the provider name on one line, or the name alone when the prefix is empty.
- 3
The provider's 16 px logo before the label, hidden from screen readers. Google and Microsoft keep their brand colours, Apple and GitHub take the text colour.
Best practices
- Do
Give each button room for its label: about 200 px with the prefix (two per row from 430 px) or 105 to 120 px without (four from 520 px). Otherwise go vertical.
- Do
Put a Divider with Label saying or between the buttons and an email form, and use the same prefix on every button of a screen: Sign up with, Continue with or Sign in with.
- Do
Show the wait and the failure next to the buttons. Wrap them in a disabled fieldset while a provider is pending, and write what happened, like Google sign-in was cancelled, not Something went wrong.
- Do
Offer only providers that work on the screen, since a button that leads nowhere is worse than a missing one. Keep the order the same on every screen.
- Don’t
Don't put three or four providers with a prefix in one row. The label does not wrap or shorten, it runs out of the button over the next one.
- Don’t
Don't draw your own marks or recolour the buttons. The marks follow each provider's brand guidelines, so use the component as it is.
- Don’t
Don't use the buttons to show which accounts are already connected, because they have no selected, connected or loading state. For connections use a list of rows with a button each.
API reference
SocialSignInButtons is a plain component, so the table lists every prop. It passes no other props on to its element, so name the group with a wrapper.
A grid with a 12 px gap: horizontal is one column below 640 px window width and one row of equal columns above, vertical is always one column. It has no border, background or role.
| Prop | Type | Default | Description |
|---|---|---|---|
| providers | SocialProvider[] | ["google", "github"] | The buttons to show, in order: , , or . Default and . |
| layout | "horizontal" | "vertical" | "horizontal" | is one row from 640 px of window width and a column below it, is always a column. Default . |
| prefix | string | "Continue with" | The words before the provider name. An empty string leaves the name alone. Default . |
| onSelect | (provider) => void | — | Called with the provider when its button is pressed. Nothing else happens: start the sign-in here. |
| className | string | — | Extra classes for the grid, for example or . |
Notes for AI
Give your coding assistant the Markdown reference instead of screenshots.
get_component("social-sign-in-buttons")npx wunderui-cli add social-sign-in-buttonsThe full library index for assistants is at /llms.txt.
Related components
Don't have an account?Sign up
Forms3 stylesText Link RowA line of text followed by a link, like “Don't have an account? Sign up”, or a back link with an arrow.