Social button
Lets people sign in or connect an account with a service they already use.
import { SocialButton } from '@halo-ds/react';
When to use it
Use social buttons on sign-in, sign-up and account-linking screens. Each one shows the provider's logo and name, so people recognise it at a glance.
Social buttons come for six providers (Apple, Google, X, LinkedIn, Dropbox and GitHub), in two styles, with or without a label, and in three states. Filled buttons use each provider's brand colour.
Do
- Name the provider in the label: "Continue with Google".
- Use the same style and width for every social button on a screen.
- Keep logos as they are: same colours, shape and proportions.
- Offer email or another option alongside social sign-in.
Don't
- Recolour a logo or put it on a colour the provider does not allow.
- Mix Filled and Outline buttons in one group.
- Use vague labels like "Login with brand" or just "Continue".
- Make social sign-in the only way in.
Props
SocialButton props
| Prop | Type | What it does | |
|---|---|---|---|
provider (required) | SocialProvider | Sets the logo and brand colour. Figma: Brand. | |
variant | `SocialButtonVariant \ | undefined` | Brand colour, or the page colour with a border. Figma: Style. |
iconOnly | `boolean \ | undefined` | Only the logo, in a 48px circle. Figma: Icon only. |
fullWidth | `boolean \ | undefined` | Stretch to the width of its container, for stacked sign-in buttons. |
children | ReactNode | The label. Defaults to "Continue with <provider>". Figma: Label. | |
classNames | `Partial<Record<SocialButtonPart, string>> \ | undefined` | Extra class names for the parts inside the component, by part name, like { header: 'my-header' }. |
styles | `Partial<Record<SocialButtonPart, CSSProperties>> \ | undefined` | Inline styles for the parts inside the component, by part name, like { footer: { gap: 4 } }. |
It also takes the usual HTML attributes for its element.
Examples
Overview
import { SocialButton } from '@halo-ds/react';
export default function Example() {
return (
<div style={{ display: 'grid', gap: 12, width: 320 }}>
<SocialButton provider="google" variant="outline" fullWidth />
<SocialButton provider="apple" fullWidth />
<SocialButton provider="github" variant="outline" fullWidth />
</div>
);
}
Providers
Apple, Google, X, LinkedIn, Dropbox and GitHub, each with its own logo and label.
import { SocialButton } from '@halo-ds/react';
export default function Demo() {
return (
<div className="demo-row">
<SocialButton provider="apple" />
<SocialButton provider="google" />
<SocialButton provider="x" />
<SocialButton provider="linkedin" />
<SocialButton provider="dropbox" />
<SocialButton provider="github" />
</div>
);
}
Filled and outline
Filled uses the brand colours of each provider. Outline is quieter, for lists of options.
import { SocialButton } from '@halo-ds/react';
export default function Demo() {
return (
<div className="demo-row">
<SocialButton provider="google" variant="filled" />
<SocialButton provider="google" variant="outline" />
</div>
);
}
Icon only
Just the logo, for a row of sign-up options.
import { SocialButton } from '@halo-ds/react';
export default function Demo() {
return (
<div className="demo-row">
<SocialButton provider="google" variant="outline" iconOnly />
<SocialButton provider="apple" variant="outline" iconOnly />
<SocialButton provider="x" variant="outline" iconOnly />
<SocialButton provider="github" variant="outline" iconOnly />
</div>
);
}
More: https://halodesignsystem.dev/components/social-button