SocialButtons
“Continue with …” buttons for the adapter’s OAuth providers, with brand marks drawn to each provider’s guidelines.
Status: beta. Category: Auth.
import { SocialButtons } from '@glyphui/auth/ui'
Exports: SocialButtons, socialButtonsStyles.
Notes
- Google and Microsoft keep their brand colors; GitHub and Apple follow the text color, as their guidelines allow.
- Unknown providers get a text-only button with their capitalized name.
- Popup flows call onSuccess; redirect flows leave the page.
SocialButtons props
| Prop | Type | Default | Description |
|---|---|---|---|
className | string | ||
label | ((name: string) => string) | Button text. Default "Continue with Google". | |
layout | "stack" | "row" | stack (default) is full-width buttons; row puts them side by side, icon and name. | |
onSuccess | ((session: AuthSession) => void) | Called after a popup sign-in completes. Redirect flows leave the page instead. | |
providers | readonly OAuthProvider[] | Default: every provider the adapter supports. |
Example: Stacked
The default: one full-width button per provider.
import { AuthProvider } from '@glyphui/auth'
import { memoryAdapter } from '@glyphui/auth/memory'
import { SocialButtons } from '@glyphui/auth/ui'
import { toast } from '@glyphui/ui'
const adapter = memoryAdapter({
latency: 600,
oauthProviders: ['google', 'github', 'apple', 'microsoft'],
})
export default function Example() {
return (
<AuthProvider adapter={adapter} syncTabs={false}>
<SocialButtons
className="w-full max-w-xs"
onSuccess={(session) => toast.success(`Signed in as ${session.user.email}`)}
/>
</AuthProvider>
)
}
Example: Side by side
layout="row" fits several providers in one line.
import { AuthProvider } from '@glyphui/auth'
import { memoryAdapter } from '@glyphui/auth/memory'
import { SocialButtons } from '@glyphui/auth/ui'
const adapter = memoryAdapter({ latency: 600 })
export default function Example() {
return (
<AuthProvider adapter={adapter} syncTabs={false}>
<SocialButtons
layout="row"
providers={['google', 'github', 'microsoft']}
className="w-full max-w-md"
/>
</AuthProvider>
)
}