Skip to content
Primitives

Social Button

OAuth buttons with brand marks for Google, Apple, GitHub, and X.

Motioninherits Button hover/tap presets

Install

Install Kineto and follow the theme setup once in your app.

bash
npm install kineto
tsx
import { SocialButton } from "kineto/social-button";

Preview

tsx
"use client";

import * as React from "react";
import { Github } from "lucide-react";

import { cn } from "@/lib/cn";
import { Button, type ButtonProps } from "@/components/ui/button";

function GoogleIcon() {
  return (
    <svg viewBox="0 0 24 24" aria-hidden>
      <path
        fill="#4285F4"
        d="M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92a5.06 5.06 0 0 1-2.2 3.32v2.77h3.57c2.08-1.92 3.27-4.74 3.27-8.1Z"
      />
      <path
        fill="#34A853"
        d="M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84A11 11 0 0 0 12 23Z"
      />
      <path
        fill="#FBBC05"
        d="M5.84 14.1a6.6 6.6 0 0 1 0-4.2V7.06H2.18a11 11 0 0 0 0 9.88l3.66-2.84Z"
      />
      <path
        fill="#EA4335"
        d="M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.06l3.66 2.84C6.71 7.31 9.14 5.38 12 5.38Z"
      />
    </svg>
  );
}

function AppleIcon() {
  return (
    <svg viewBox="0 0 24 24" fill="currentColor" aria-hidden>
      <path d="M17.05 12.54c-.02-2.16 1.76-3.2 1.84-3.25-1-1.47-2.56-1.67-3.12-1.69-1.33-.13-2.6.78-3.27.78-.67 0-1.71-.76-2.82-.74-1.45.02-2.79.84-3.53 2.14-1.5 2.61-.38 6.47 1.08 8.59.71 1.04 1.56 2.2 2.67 2.16 1.07-.04 1.48-.69 2.77-.69 1.29 0 1.66.69 2.79.67 1.15-.02 1.88-1.05 2.59-2.1.82-1.2 1.16-2.36 1.18-2.42-.03-.01-2.26-.87-2.28-3.43ZM14.93 6.2c.59-.72.99-1.71.88-2.7-.85.03-1.88.57-2.49 1.28-.55.63-1.03 1.64-.9 2.6.95.08 1.92-.48 2.51-1.18Z" />
    </svg>
  );
}

function XIcon() {
  return (
    <svg viewBox="0 0 24 24" fill="currentColor" aria-hidden>
      <path d="M18.244 2.25h3.308l-7.227 8.26 8.502 11.24H16.17l-5.214-6.817L4.99 21.75H1.68l7.73-8.835L1.254 2.25H8.08l4.713 6.231 5.45-6.231Zm-1.161 17.52h1.833L7.084 4.126H5.117L17.083 19.77Z" />
    </svg>
  );
}

type Provider = "google" | "apple" | "github" | "x";

const labels: Record<Provider, string> = {
  google: "Continue with Google",
  apple: "Continue with Apple",
  github: "Continue with GitHub",
  x: "Continue with X",
};

const icons: Record<Provider, React.ReactNode> = {
  google: <GoogleIcon />,
  apple: <AppleIcon />,
  github: <Github />,
  x: <XIcon />,
};

export interface SocialButtonProps extends Omit<ButtonProps, "children"> {
  provider: Provider;
  /** Override the default "Continue with …" label. */
  label?: React.ReactNode;
}

const SocialButton = React.forwardRef<HTMLButtonElement, SocialButtonProps>(
  ({ provider, label, className, variant = "outline", ...props }, ref) => (
    <Button
      ref={ref}
      variant={variant}
      className={cn("w-full gap-2.5", className)}
      {...props}
    >
      {icons[provider]}
      {label ?? labels[provider]}
    </Button>
  )
);
SocialButton.displayName = "SocialButton";

export { SocialButton };

src/components/ui/social-button.tsx

Props

PropTypeDefaultDescription
provider"google" | "apple" | "github" | "x"—Brand.
labelReactNode—Override the default label.