Command Palette

Search for a command to run...

Docs
Auth Tabs Card

Auth Tabs Card

Tabbed authentication card with sign-in/sign-up forms and social login options

Loading...

Installation

Usage

import AuthTabsCard from "@/components/ruixen/auth-tabs-card";
import { FaGoogle, FaGithub } from "react-icons/fa";
 
export default function App() {
  const socialButtons = [
    {
      id: "google",
      label: "Continue with Google",
      icon: FaGoogle,
      onClick: () => console.log("Google login"),
    },
    {
      id: "github",
      label: "Continue with GitHub",
      icon: FaGithub,
      onClick: () => console.log("GitHub login"),
    },
  ];
 
  const handleSignIn = (data: Record<string, string>) => {
    console.log("Sign in:", data);
  };
 
  const handleSignUp = (data: Record<string, string>) => {
    console.log("Sign up:", data);
  };
 
  return (
    <AuthTabsCard
      socialButtons={socialButtons}
      onSignIn={handleSignIn}
      onSignUp={handleSignUp}
    />
  );
}

Props

PropTypeDefaultDescription
signInFieldsField[]Default email/passwordSign-in form fields
signUpFieldsField[]Default name/email/passwordSign-up form fields
socialButtonsSocialButton[][]Social login buttons
onSignIn(data: Record<string, string>) => void-Sign-in handler
onSignUp(data: Record<string, string>) => void-Sign-up handler
classNamestring""Additional CSS classes

Features

  • Tabbed Interface: Switch between Sign In and Sign Up
  • Social Login: Configurable social authentication buttons
  • Custom Fields: Customize form fields for both tabs
  • Form Validation: Built-in input validation
  • Responsive Design: Adapts to different screen sizes
  • Icon Support: React Icons integration for social buttons

Social Button Type

export interface SocialButton {
  id: string;
  label: string;
  icon: IconType;
  onClick: () => void;
  variant?: "default" | "outline";
}

Field Type

export interface Field {
  id: string;
  label: string;
  type: string;
  placeholder?: string;
}

Default Fields

Sign In:

  • Email (email input)
  • Password (password input)

Sign Up:

  • Name (text input)
  • Email (email input)
  • Password (password input)