Social Button
A simple and flexible social login button component that wraps the Button component, providing clean styling for social authentication flows. Pass any icon as children for maximum flexibility. Built with Ark UI factory for accessibility and styled using Ocean UI design tokens.
Example
import { SocialButton } from "@/components/ui/social-button";
function GithubIcon() {
return (
<svg className="size-5" viewBox="0 0 24 24" fill="currentColor">
<path d="M12 0c-6.626 0-12 5.373-12 12 0 5.302 3.438 9.8 8.207 11.387.599.111.793-.261.793-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.756-1.333-1.756-1.089-.745.083-.729.083-.729 1.205.084 1.839 1.237 1.839 1.237 1.07 1.834 2.807 1.304 3.492.997.107-.775.418-1.305.762-1.604-2.665-.305-5.467-1.334-5.467-5.931 0-1.311.469-2.381 1.236-3.221-.124-.303-.535-1.524.117-3.176 0 0 1.008-.322 3.301 1.23.957-.266 1.983-.399 3.003-.404 1.02.005 2.047.138 3.006.404 2.291-1.552 3.297-1.23 3.297-1.23.653 1.653.242 2.874.118 3.176.77.84 1.235 1.911 1.235 3.221 0 4.609-2.807 5.624-5.479 5.921.43.372.823 1.102.823 2.222v3.293c0 .319.192.694.801.576 4.765-1.589 8.199-6.086 8.199-11.386 0-6.627-5.373-12-12-12z" />
</svg>
);
}
function AppleIcon() {
return (
<svg
xmlns="http://www.w3.org/2000/svg"
fill="currentColor"
className="size-5"
viewBox="0 0 16 16"
>
<path d="M11.182.008C11.148-.03 9.923.023 8.857 1.18c-1.066 1.156-.902 2.482-.878 2.516s1.52.087 2.475-1.258.762-2.391.728-2.43m3.314 11.733c-.048-.096-2.325-1.234-2.113-3.422s1.675-2.789 1.698-2.854-.597-.79-1.254-1.157a3.7 3.7 0 0 0-1.563-.434c-.108-.003-.483-.095-1.254.116-.508.139-1.653.589-1.968.607-.316.018-1.256-.522-2.267-.665-.647-.125-1.333.131-1.824.328-.49.196-1.422.754-2.074 2.237-.652 1.482-.311 3.83-.067 4.56s.625 1.924 1.273 2.796c.576.984 1.34 1.667 1.659 1.899s1.219.386 1.843.067c.502-.308 1.408-.485 1.766-.472.357.013 1.061.154 1.782.539.571.197 1.111.115 1.652-.105.541-.221 1.324-1.059 2.238-2.758q.52-1.185.473-1.282" />
<path d="M11.182.008C11.148-.03 9.923.023 8.857 1.18c-1.066 1.156-.902 2.482-.878 2.516s1.52.087 2.475-1.258.762-2.391.728-2.43m3.314 11.733c-.048-.096-2.325-1.234-2.113-3.422s1.675-2.789 1.698-2.854-.597-.79-1.254-1.157a3.7 3.7 0 0 0-1.563-.434c-.108-.003-.483-.095-1.254.116-.508.139-1.653.589-1.968.607-.316.018-1.256-.522-2.267-.665-.647-.125-1.333.131-1.824.328-.49.196-1.422.754-2.074 2.237-.652 1.482-.311 3.83-.067 4.56s.625 1.924 1.273 2.796c.576.984 1.34 1.667 1.659 1.899s1.219.386 1.843.067c.502-.308 1.408-.485 1.766-.472.357.013 1.061.154 1.782.539.571.197 1.111.115 1.652-.105.541-.221 1.324-1.059 2.238-2.758q.52-1.185.473-1.282" />
</svg>
);
}
export default function SocialButtonDemo() {
return (
<div className="flex gap-6">
{/* Left column: Text buttons with icons */}
<div className="flex flex-col gap-3">
<SocialButton size="lg">
<GithubIcon />
Sign in with GitHub
</SocialButton>
<SocialButton variant="dark" size="lg">
<AppleIcon />
Sign in with Apple
</SocialButton>
</div>
{/* Right column: Icon-only buttons */}
<div className="flex flex-col gap-3 items-start">
<SocialButton variant="icon-only" size="icon-md">
<GithubIcon />
</SocialButton>
<SocialButton
variant="icon-only"
size="icon-md"
className="bg-black text-white border-0 hover:bg-black/90 dark:bg-white dark:text-black dark:hover:bg-white/90"
>
<AppleIcon />
</SocialButton>
</div>
</div>
);
}
import { SocialButton } from "@/components/ui/social-button";
function GithubIcon() {
return (
<svg class="size-5" viewBox="0 0 24 24" fill="currentColor">
<path d="M12 0c-6.626 0-12 5.373-12 12 0 5.302 3.438 9.8 8.207 11.387.599.111.793-.261.793-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.756-1.333-1.756-1.089-.745.083-.729.083-.729 1.205.084 1.839 1.237 1.839 1.237 1.07 1.834 2.807 1.304 3.492.997.107-.775.418-1.305.762-1.604-2.665-.305-5.467-1.334-5.467-5.931 0-1.311.469-2.381 1.236-3.221-.124-.303-.535-1.524.117-3.176 0 0 1.008-.322 3.301 1.23.957-.266 1.983-.399 3.003-.404 1.02.005 2.047.138 3.006.404 2.291-1.552 3.297-1.23 3.297-1.23.653 1.653.242 2.874.118 3.176.77.84 1.235 1.911 1.235 3.221 0 4.609-2.807 5.624-5.479 5.921.43.372.823 1.102.823 2.222v3.293c0 .319.192.694.801.576 4.765-1.589 8.199-6.086 8.199-11.386 0-6.627-5.373-12-12-12z" />
</svg>
);
}
function AppleIcon() {
return (
<svg
xmlns="http://www.w3.org/2000/svg"
fill="currentColor"
class="size-5"
viewBox="0 0 16 16"
>
<path d="M11.182.008C11.148-.03 9.923.023 8.857 1.18c-1.066 1.156-.902 2.482-.878 2.516s1.52.087 2.475-1.258.762-2.391.728-2.43m3.314 11.733c-.048-.096-2.325-1.234-2.113-3.422s1.675-2.789 1.698-2.854-.597-.79-1.254-1.157a3.7 3.7 0 0 0-1.563-.434c-.108-.003-.483-.095-1.254.116-.508.139-1.653.589-1.968.607-.316.018-1.256-.522-2.267-.665-.647-.125-1.333.131-1.824.328-.49.196-1.422.754-2.074 2.237-.652 1.482-.311 3.83-.067 4.56s.625 1.924 1.273 2.796c.576.984 1.34 1.667 1.659 1.899s1.219.386 1.843.067c.502-.308 1.408-.485 1.766-.472.357.013 1.061.154 1.782.539.571.197 1.111.115 1.652-.105.541-.221 1.324-1.059 2.238-2.758q.52-1.185.473-1.282" />
<path d="M11.182.008C11.148-.03 9.923.023 8.857 1.18c-1.066 1.156-.902 2.482-.878 2.516s1.52.087 2.475-1.258.762-2.391.728-2.43m3.314 11.733c-.048-.096-2.325-1.234-2.113-3.422s1.675-2.789 1.698-2.854-.597-.79-1.254-1.157a3.7 3.7 0 0 0-1.563-.434c-.108-.003-.483-.095-1.254.116-.508.139-1.653.589-1.968.607-.316.018-1.256-.522-2.267-.665-.647-.125-1.333.131-1.824.328-.49.196-1.422.754-2.074 2.237-.652 1.482-.311 3.83-.067 4.56s.625 1.924 1.273 2.796c.576.984 1.34 1.667 1.659 1.899s1.219.386 1.843.067c.502-.308 1.408-.485 1.766-.472.357.013 1.061.154 1.782.539.571.197 1.111.115 1.652-.105.541-.221 1.324-1.059 2.238-2.758q.52-1.185.473-1.282" />
</svg>
);
}
export default function SocialButtonDemo() {
return (
<div class="flex gap-6">
{/* Left column: Text buttons with icons */}
<div class="flex flex-col gap-3">
<SocialButton size="lg">
<GithubIcon />
Sign in with GitHub
</SocialButton>
<SocialButton variant="dark" size="lg">
<AppleIcon />
Sign in with Apple
</SocialButton>
</div>
{/* Right column: Icon-only buttons */}
<div class="flex flex-col gap-3 items-start">
<SocialButton variant="icon-only" size="icon-md">
<GithubIcon />
</SocialButton>
<SocialButton
variant="icon-only"
size="icon-md"
class="bg-black text-white border-0 hover:bg-black/90 dark:bg-white dark:text-black dark:hover:bg-white/90"
>
<AppleIcon />
</SocialButton>
</div>
</div>
);
}
How to install and use
Complete the manual installation setup
If you haven't already completed the first 4 steps of the manual installation guide, please do so before continuing to install these components.
Create a social-button.tsx file and paste the following code into it.
import { cva, type VariantProps } from "class-variance-authority";
import { ark } from "@ark-ui/react/factory";
import type { ComponentProps } from "react";
import { cn } from "@/lib/utils";
const socialButtonVariants = cva(
"inline-flex items-center justify-center gap-3 px-6 whitespace-nowrap rounded-lg text-sm font-semibold transition-all outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0",
{
variants: {
variant: {
default:
"bg-white dark:bg-background border border-border text-foreground hover:bg-muted",
filled:
"bg-primary text-primary-foreground border-0 shadow-xs hover:bg-primary/90",
dark: "bg-black text-white border-0 shadow-xs hover:bg-black/90 dark:bg-white dark:text-black dark:hover:bg-white/90",
"icon-only":
"bg-white dark:bg-background border border-border text-foreground hover:bg-muted aspect-square",
},
size: {
sm: "min-h-8 [&_svg]:size-4",
md: "min-h-9 [&_svg]:size-5",
lg: "min-h-10 [&_svg]:size-5",
xl: "min-h-11 [&_svg]:size-5",
"icon-sm": "h-8 w-8 [&_svg]:size-4",
"icon-md": "h-10 w-10 [&_svg]:size-5",
"icon-lg": "h-12 w-12 [&_svg]:size-6",
},
fullWidth: {
true: "w-full",
false: "",
},
},
defaultVariants: {
variant: "default",
size: "sm",
fullWidth: false,
},
},
);
export interface SocialButtonProps
extends ComponentProps<typeof ark.button>,
VariantProps<typeof socialButtonVariants> {
children?: React.ReactNode;
}
function SocialButton({
variant,
size,
fullWidth,
className,
children,
...props
}: SocialButtonProps) {
// For icon-only variant, override size to use icon size variants
const finalSize =
variant === "icon-only" && size && !size.startsWith("icon-")
? (`icon-${size}` as "icon-sm" | "icon-md" | "icon-lg")
: size;
return (
<ark.button
type="button"
data-slot="social-button"
className={cn(
socialButtonVariants({
variant,
size: finalSize,
fullWidth,
className,
}),
)}
{...props}
>
{children}
</ark.button>
);
}
export { SocialButton, socialButtonVariants };
import { cva, type VariantProps } from "class-variance-authority";
import { ark } from "@ark-ui/solid/factory";
import type { ComponentProps, ParentComponent } from "solid-js";
import { splitProps } from "solid-js";
import { cn } from "@/lib/utils";
const socialButtonVariants = cva(
"inline-flex items-center justify-center gap-3 px-6 whitespace-nowrap rounded-lg text-sm font-semibold transition-all outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0",
{
variants: {
variant: {
default:
"bg-white dark:bg-background border border-border text-foreground hover:bg-muted",
filled:
"bg-primary text-primary-foreground border-0 shadow-xs hover:bg-primary/90",
dark: "bg-black text-white border-0 shadow-xs hover:bg-black/90 dark:bg-white dark:text-black dark:hover:bg-white/90",
"icon-only":
"bg-white dark:bg-background border border-border text-foreground hover:bg-muted aspect-square",
},
size: {
sm: "min-h-8 [&_svg]:size-4",
md: "min-h-9 [&_svg]:size-5",
lg: "min-h-10 [&_svg]:size-5",
xl: "min-h-11 [&_svg]:size-5",
"icon-sm": "h-8 w-8 [&_svg]:size-4",
"icon-md": "h-10 w-10 [&_svg]:size-5",
"icon-lg": "h-12 w-12 [&_svg]:size-6",
},
fullWidth: {
true: "w-full",
false: "",
},
},
defaultVariants: {
variant: "default",
size: "sm",
fullWidth: false,
},
},
);
export interface SocialButtonProps
extends ComponentProps<typeof ark.button>,
VariantProps<typeof socialButtonVariants> {}
export const SocialButton: ParentComponent<SocialButtonProps> = (props) => {
const [local, rest] = splitProps(props, ["variant", "size", "fullWidth", "class"]);
// For icon-only variant, override size to use icon size variants
const finalSize =
local.variant === "icon-only" && local.size && !local.size.startsWith("icon-")
? (`icon-${local.size}` as "icon-sm" | "icon-md" | "icon-lg")
: local.size;
return (
<ark.button
type="button"
data-slot="social-button"
class={cn(
socialButtonVariants({
variant: local.variant,
size: finalSize,
fullWidth: local.fullWidth,
}),
local.class,
)}
{...rest}
/>
);
};
export { socialButtonVariants };
import { cva, type VariantProps } from "class-variance-authority";
import { ark } from "@ark-ui/react/factory";
import type { ComponentProps } from "react";
import { cn } from "@/lib/utils";
const socialButtonVariants = cva(
"inline-flex items-center justify-center gap-3 px-6 whitespace-nowrap rounded-lg text-sm font-semibold transition-all outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0",
{
variants: {
variant: {
default:
"bg-white dark:bg-background border border-border text-foreground hover:bg-muted",
filled:
"bg-primary text-primary-foreground border-0 shadow-xs hover:bg-primary/90",
dark: "bg-black text-white border-0 shadow-xs hover:bg-black/90 dark:bg-white dark:text-black dark:hover:bg-white/90",
"icon-only":
"bg-white dark:bg-background border border-border text-foreground hover:bg-muted aspect-square",
},
size: {
sm: "min-h-8 [&_svg]:size-4",
md: "min-h-9 [&_svg]:size-5",
lg: "min-h-10 [&_svg]:size-5",
xl: "min-h-11 [&_svg]:size-5",
"icon-sm": "h-8 w-8 [&_svg]:size-4",
"icon-md": "h-10 w-10 [&_svg]:size-5",
"icon-lg": "h-12 w-12 [&_svg]:size-6",
},
fullWidth: {
true: "w-full",
false: "",
},
},
defaultVariants: {
variant: "default",
size: "sm",
fullWidth: false,
},
},
);
export interface SocialButtonProps
extends ComponentProps<typeof ark.button>,
VariantProps<typeof socialButtonVariants> {
children?: React.ReactNode;
}
function SocialButton({
variant,
size,
fullWidth,
className,
children,
...props
}: SocialButtonProps) {
// For icon-only variant, override size to use icon size variants
const finalSize =
variant === "icon-only" && size && !size.startsWith("icon-")
? (`icon-${size}` as "icon-sm" | "icon-md" | "icon-lg")
: size;
return (
<ark.button
type="button"
data-slot="social-button"
className={cn(
socialButtonVariants({
variant,
size: finalSize,
fullWidth,
className,
}),
)}
{...props}
>
{children}
</ark.button>
);
}
export { SocialButton, socialButtonVariants };
import { cva, type VariantProps } from "class-variance-authority";
import { ark } from "@ark-ui/react/factory";
import type { ComponentProps } from "react";
import { cn } from "@/lib/utils";
const socialButtonVariants = cva(
"inline-flex items-center justify-center gap-3 px-6 whitespace-nowrap rounded-lg text-sm font-semibold transition-all outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0",
{
variants: {
variant: {
default:
"bg-white dark:bg-background border border-border text-foreground hover:bg-muted",
filled:
"bg-primary text-primary-foreground border-0 shadow-xs hover:bg-primary/90",
dark: "bg-black text-white border-0 shadow-xs hover:bg-black/90 dark:bg-white dark:text-black dark:hover:bg-white/90",
"icon-only":
"bg-white dark:bg-background border border-border text-foreground hover:bg-muted aspect-square",
},
size: {
sm: "min-h-8 [&_svg]:size-4",
md: "min-h-9 [&_svg]:size-5",
lg: "min-h-10 [&_svg]:size-5",
xl: "min-h-11 [&_svg]:size-5",
"icon-sm": "h-8 w-8 [&_svg]:size-4",
"icon-md": "h-10 w-10 [&_svg]:size-5",
"icon-lg": "h-12 w-12 [&_svg]:size-6",
},
fullWidth: {
true: "w-full",
false: "",
},
},
defaultVariants: {
variant: "default",
size: "sm",
fullWidth: false,
},
},
);
export interface SocialButtonProps
extends ComponentProps<typeof ark.button>,
VariantProps<typeof socialButtonVariants> {
children?: React.ReactNode;
}
function SocialButton({
variant,
size,
fullWidth,
className,
children,
...props
}: SocialButtonProps) {
// For icon-only variant, override size to use icon size variants
const finalSize =
variant === "icon-only" && size && !size.startsWith("icon-")
? (`icon-${size}` as "icon-sm" | "icon-md" | "icon-lg")
: size;
return (
<ark.button
type="button"
data-slot="social-button"
className={cn(
socialButtonVariants({
variant,
size: finalSize,
fullWidth,
className,
}),
)}
{...props}
>
{children}
</ark.button>
);
}
export { SocialButton, socialButtonVariants };
Finally, Choose any example you like and add it to your project.
For instance, create a new file at components/shared/{example-component-name}.tsx, paste the example code into that file, and then import and use the component wherever you need it in your application.
The SocialButton component wraps the Button component and uses Ark UI's
factory function (ark.button) for built-in accessibility. It's styled with
Tailwind CSS using Ocean UI design tokens from tokens.css.
Overview
A flexible button component for social login flows. Pass any icon and text as children for maximum customization. Built with Ark UI for accessibility.
Variants
The SocialButton component supports four visual variants:
- default: Light background with border (default style) -
variant="default"or no variant prop - filled: Solid background with primary color, no border -
variant="filled" - dark: Black background with white text, perfect for Apple-style buttons -
variant="dark" - icon-only: Square button with only an icon -
variant="icon-only"
Sizes
The SocialButton component supports multiple sizes:
Text Button Sizes:
- sm: Small button (
size="sm") - min-height: 32px - md: Medium button (
size="md") - min-height: 36px - default - lg: Large button (
size="lg") - min-height: 40px - xl: Extra large button (
size="xl") - min-height: 44px
Icon-Only Button Sizes:
- icon-sm: Small square (
size="icon-sm") - 32x32px - icon-md: Medium square (
size="icon-md") - 40x40px - icon-lg: Large square (
size="icon-lg") - 48x48px
Features
- Simple API: Just pass icon and text as children - no complex props needed
- Flexible Icons: Use any icon component (SVG, Lucide React, custom components)
- Multiple Variants: Default, filled, dark, and icon-only styles
- Size Control: Use
sizeprop to control button height and icon size - Full Width: Use
fullWidth={true}for buttons that span the container width - Disabled State: Use
disabledprop for non-interactive buttons - Accessibility: Full keyboard navigation and ARIA support via Ark UI
- Icon-Only Accessibility: Icon-only buttons require
aria-labelprop for screen reader support - Customizable: All styles can be overridden via
classNameprop
Select Examples
Filled Variant
Filled variant buttons use variant="filled" to display a solid background with primary color and no border. Perfect for prominent social login actions that need to stand out.
Props used: variant="filled"
import { SocialButton } from "@/components/ui/social-button";
function GithubIcon() {
return (
<svg className="size-5" viewBox="0 0 24 24" fill="currentColor">
<path d="M12 0c-6.626 0-12 5.373-12 12 0 5.302 3.438 9.8 8.207 11.387.599.111.793-.261.793-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.756-1.333-1.756-1.089-.745.083-.729.083-.729 1.205.084 1.839 1.237 1.839 1.237 1.07 1.834 2.807 1.304 3.492.997.107-.775.418-1.305.762-1.604-2.665-.305-5.467-1.334-5.467-5.931 0-1.311.469-2.381 1.236-3.221-.124-.303-.535-1.524.117-3.176 0 0 1.008-.322 3.301 1.23.957-.266 1.983-.399 3.003-.404 1.02.005 2.047.138 3.006.404 2.291-1.552 3.297-1.23 3.297-1.23.653 1.653.242 2.874.118 3.176.77.84 1.235 1.911 1.235 3.221 0 4.609-2.807 5.624-5.479 5.921.43.372.823 1.102.823 2.222v3.293c0 .319.192.694.801.576 4.765-1.589 8.199-6.086 8.199-11.386 0-6.627-5.373-12-12-12z" />
</svg>
);
}
export default function SocialButtonFilled() {
return (
<div className="flex flex-col gap-3">
<SocialButton variant="filled" size="lg">
<GithubIcon />
Continue with GitHub
</SocialButton>
</div>
);
}
import { SocialButton } from "@/components/ui/social-button";
function GithubIcon() {
return (
<svg class="size-5" viewBox="0 0 24 24" fill="currentColor">
<path d="M12 0c-6.626 0-12 5.373-12 12 0 5.302 3.438 9.8 8.207 11.387.599.111.793-.261.793-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.756-1.333-1.756-1.089-.745.083-.729.083-.729 1.205.084 1.839 1.237 1.839 1.237 1.07 1.834 2.807 1.304 3.492.997.107-.775.418-1.305.762-1.604-2.665-.305-5.467-1.334-5.467-5.931 0-1.311.469-2.381 1.236-3.221-.124-.303-.535-1.524.117-3.176 0 0 1.008-.322 3.301 1.23.957-.266 1.983-.399 3.003-.404 1.02.005 2.047.138 3.006.404 2.291-1.552 3.297-1.23 3.297-1.23.653 1.653.242 2.874.118 3.176.77.84 1.235 1.911 1.235 3.221 0 4.609-2.807 5.624-5.479 5.921.43.372.823 1.102.823 2.222v3.293c0 .319.192.694.801.576 4.765-1.589 8.199-6.086 8.199-11.386 0-6.627-5.373-12-12-12z" />
</svg>
);
}
export default function SocialButtonFilled() {
return (
<div class="flex flex-col gap-3">
<SocialButton variant="filled" size="lg">
<GithubIcon />
Continue with GitHub
</SocialButton>
</div>
);
}
Icon Only Variant
Icon-only buttons use variant="icon-only" with size="icon-md" to create square buttons containing only an icon. Perfect for compact interfaces or when space is limited.
Important: Since icon-only buttons have no visible text, you must provide an aria-label prop so screen readers can announce what the button does. Buttons with text content don't need aria-label as the text serves as the accessible name.
Props used: variant="icon-only", size="icon-md",
import { SocialButton } from "@/components/ui/social-button";
function GithubIcon() {
return (
<svg className="size-5" viewBox="0 0 24 24" fill="currentColor">
<path d="M12 0c-6.626 0-12 5.373-12 12 0 5.302 3.438 9.8 8.207 11.387.599.111.793-.261.793-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.756-1.333-1.756-1.089-.745.083-.729.083-.729 1.205.084 1.839 1.237 1.839 1.237 1.07 1.834 2.807 1.304 3.492.997.107-.775.418-1.305.762-1.604-2.665-.305-5.467-1.334-5.467-5.931 0-1.311.469-2.381 1.236-3.221-.124-.303-.535-1.524.117-3.176 0 0 1.008-.322 3.301 1.23.957-.266 1.983-.399 3.003-.404 1.02.005 2.047.138 3.006.404 2.291-1.552 3.297-1.23 3.297-1.23.653 1.653.242 2.874.118 3.176.77.84 1.235 1.911 1.235 3.221 0 4.609-2.807 5.624-5.479 5.921.43.372.823 1.102.823 2.222v3.293c0 .319.192.694.801.576 4.765-1.589 8.199-6.086 8.199-11.386 0-6.627-5.373-12-12-12z" />
</svg>
);
}
export default function SocialButtonIconOnly() {
return (
<div className="flex flex-col gap-3">
<div className="flex items-center gap-3">
<SocialButton variant="icon-only" size="icon-md">
<GithubIcon />
</SocialButton>
<SocialButton
variant="icon-only"
size="icon-md"
className="bg-primary text-primary-foreground border-0 hover:bg-primary/90"
>
<GithubIcon />
</SocialButton>
</div>
</div>
);
}
import { SocialButton } from "@/components/ui/social-button";
function GithubIcon() {
return (
<svg class="size-5" viewBox="0 0 24 24" fill="currentColor">
<path d="M12 0c-6.626 0-12 5.373-12 12 0 5.302 3.438 9.8 8.207 11.387.599.111.793-.261.793-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.756-1.333-1.756-1.089-.745.083-.729.083-.729 1.205.084 1.839 1.237 1.839 1.237 1.07 1.834 2.807 1.304 3.492.997.107-.775.418-1.305.762-1.604-2.665-.305-5.467-1.334-5.467-5.931 0-1.311.469-2.381 1.236-3.221-.124-.303-.535-1.524.117-3.176 0 0 1.008-.322 3.301 1.23.957-.266 1.983-.399 3.003-.404 1.02.005 2.047.138 3.006.404 2.291-1.552 3.297-1.23 3.297-1.23.653 1.653.242 2.874.118 3.176.77.84 1.235 1.911 1.235 3.221 0 4.609-2.807 5.624-5.479 5.921.43.372.823 1.102.823 2.222v3.293c0 .319.192.694.801.576 4.765-1.589 8.199-6.086 8.199-11.386 0-6.627-5.373-12-12-12z" />
</svg>
);
}
export default function SocialButtonIconOnly() {
return (
<div class="flex flex-col gap-3">
<div class="flex items-center gap-3">
<SocialButton variant="icon-only" size="icon-md">
<GithubIcon />
</SocialButton>
<SocialButton
variant="icon-only"
size="icon-md"
class="bg-primary text-primary-foreground border-0 hover:bg-primary/90"
>
<GithubIcon />
</SocialButton>
</div>
</div>
);
}
Full Width Buttons
Full width buttons use fullWidth={true} to span the entire width of their container. Ideal for mobile interfaces or when you want maximum button prominence. Can be combined with any variant.
Props used: fullWidth={true}, variant="filled" (optional)
import { SocialButton } from "@/components/ui/social-button";
function GithubIcon() {
return (
<svg className="size-5" viewBox="0 0 24 24" fill="currentColor">
<path d="M12 0c-6.626 0-12 5.373-12 12 0 5.302 3.438 9.8 8.207 11.387.599.111.793-.261.793-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.756-1.333-1.756-1.089-.745.083-.729.083-.729 1.205.084 1.839 1.237 1.839 1.237 1.07 1.834 2.807 1.304 3.492.997.107-.775.418-1.305.762-1.604-2.665-.305-5.467-1.334-5.467-5.931 0-1.311.469-2.381 1.236-3.221-.124-.303-.535-1.524.117-3.176 0 0 1.008-.322 3.301 1.23.957-.266 1.983-.399 3.003-.404 1.02.005 2.047.138 3.006.404 2.291-1.552 3.297-1.23 3.297-1.23.653 1.653.242 2.874.118 3.176.77.84 1.235 1.911 1.235 3.221 0 4.609-2.807 5.624-5.479 5.921.43.372.823 1.102.823 2.222v3.293c0 .319.192.694.801.576 4.765-1.589 8.199-6.086 8.199-11.386 0-6.627-5.373-12-12-12z" />
</svg>
);
}
export default function SocialButtonFullWidth() {
return (
<div className="flex flex-col gap-3 max-w-sm w-full">
<SocialButton fullWidth>
<GithubIcon />
Continue with GitHub
</SocialButton>
<SocialButton variant="filled" fullWidth>
<GithubIcon />
Continue with GitHub
</SocialButton>
</div>
);
}
import { SocialButton } from "@/components/ui/social-button";
function GithubIcon() {
return (
<svg class="size-5" viewBox="0 0 24 24" fill="currentColor">
<path d="M12 0c-6.626 0-12 5.373-12 12 0 5.302 3.438 9.8 8.207 11.387.599.111.793-.261.793-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.756-1.333-1.756-1.089-.745.083-.729.083-.729 1.205.084 1.839 1.237 1.839 1.237 1.07 1.834 2.807 1.304 3.492.997.107-.775.418-1.305.762-1.604-2.665-.305-5.467-1.334-5.467-5.931 0-1.311.469-2.381 1.236-3.221-.124-.303-.535-1.524.117-3.176 0 0 1.008-.322 3.301 1.23.957-.266 1.983-.399 3.003-.404 1.02.005 2.047.138 3.006.404 2.291-1.552 3.297-1.23 3.297-1.23.653 1.653.242 2.874.118 3.176.77.84 1.235 1.911 1.235 3.221 0 4.609-2.807 5.624-5.479 5.921.43.372.823 1.102.823 2.222v3.293c0 .319.192.694.801.576 4.765-1.589 8.199-6.086 8.199-11.386 0-6.627-5.373-12-12-12z" />
</svg>
);
}
export default function SocialButtonFullWidth() {
return (
<div class="flex flex-col gap-3 max-w-sm w-full">
<SocialButton fullWidth>
<GithubIcon />
Continue with GitHub
</SocialButton>
<SocialButton variant="filled" fullWidth>
<GithubIcon />
Continue with GitHub
</SocialButton>
</div>
);
}
Disabled State
Disabled social buttons use the disabled prop to make them non-interactive. They maintain their visual style but appear faded and cannot be clicked. Useful when authentication is temporarily unavailable.
Props used: disabled
import { SocialButton } from "@/components/ui/social-button";
function GithubIcon() {
return (
<svg className="size-5" viewBox="0 0 24 24" fill="currentColor">
<path d="M12 0c-6.626 0-12 5.373-12 12 0 5.302 3.438 9.8 8.207 11.387.599.111.793-.261.793-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.756-1.333-1.756-1.089-.745.083-.729.083-.729 1.205.084 1.839 1.237 1.839 1.237 1.07 1.834 2.807 1.304 3.492.997.107-.775.418-1.305.762-1.604-2.665-.305-5.467-1.334-5.467-5.931 0-1.311.469-2.381 1.236-3.221-.124-.303-.535-1.524.117-3.176 0 0 1.008-.322 3.301 1.23.957-.266 1.983-.399 3.003-.404 1.02.005 2.047.138 3.006.404 2.291-1.552 3.297-1.23 3.297-1.23.653 1.653.242 2.874.118 3.176.77.84 1.235 1.911 1.235 3.221 0 4.609-2.807 5.624-5.479 5.921.43.372.823 1.102.823 2.222v3.293c0 .319.192.694.801.576 4.765-1.589 8.199-6.086 8.199-11.386 0-6.627-5.373-12-12-12z" />
</svg>
);
}
export default function SocialButtonDisabled() {
return (
<div className="flex flex-col gap-3">
<SocialButton disabled>
<GithubIcon />
Continue with GitHub
</SocialButton>
</div>
);
}
import { SocialButton } from "@/components/ui/social-button";
function GithubIcon() {
return (
<svg class="size-5" viewBox="0 0 24 24" fill="currentColor">
<path d="M12 0c-6.626 0-12 5.373-12 12 0 5.302 3.438 9.8 8.207 11.387.599.111.793-.261.793-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.756-1.333-1.756-1.089-.745.083-.729.083-.729 1.205.084 1.839 1.237 1.839 1.237 1.07 1.834 2.807 1.304 3.492.997.107-.775.418-1.305.762-1.604-2.665-.305-5.467-1.334-5.467-5.931 0-1.311.469-2.381 1.236-3.221-.124-.303-.535-1.524.117-3.176 0 0 1.008-.322 3.301 1.23.957-.266 1.983-.399 3.003-.404 1.02.005 2.047.138 3.006.404 2.291-1.552 3.297-1.23 3.297-1.23.653 1.653.242 2.874.118 3.176.77.84 1.235 1.911 1.235 3.221 0 4.609-2.807 5.624-5.479 5.921.43.372.823 1.102.823 2.222v3.293c0 .319.192.694.801.576 4.765-1.589 8.199-6.086 8.199-11.386 0-6.627-5.373-12-12-12z" />
</svg>
);
}
export default function SocialButtonDisabled() {
return (
<div class="flex flex-col gap-3">
<SocialButton disabled>
<GithubIcon />
Continue with GitHub
</SocialButton>
</div>
);
}