Command Palette

Search for a command to run...

Docs
Login Card

Login Card

Clean and simple login card with customizable inputs and logo support

Loading...

Installation

Usage

import LoginCard from "@/components/ruixen/login-card";
import { FaUserCircle } from "react-icons/fa";
 
export default function App() {
  const handleChange = (values: Record<string, string>) => {
    console.log("Form values:", values);
  };
 
  const handleSubmit = (values: Record<string, string>) => {
    console.log("Login attempt:", values);
  };
 
  return (
    <LoginCard
      title="Welcome Back"
      logo={<FaUserCircle size={48} className="text-blue-500" />}
      inputs={[
        {
          id: "email",
          type: "email",
          label: "Email",
          placeholder: "[email protected]",
        },
        {
          id: "password",
          type: "password",
          label: "Password",
          placeholder: "********",
        },
      ]}
      buttonText="Sign In"
      onChange={handleChange}
      onSubmit={handleSubmit}
    />
  );
}

Props

PropTypeDefaultDescription
titlestring"Sign In"Card title
inputsLoginInput[]Email/password fieldsForm input configuration
buttonTextstring"Login"Submit button text
logoReact.ReactNode-Logo or icon to display
classNamestring-Additional CSS classes
onChange(values: Record<string, string>) => void-Input change handler
onSubmit(values: Record<string, string>) => void-Form submit handler

Features

  • Clean Design: Minimalist and professional appearance
  • Logo Support: Display company logo or icon
  • Customizable Inputs: Configure form fields as needed
  • Full Screen Layout: Centered card with background
  • Sign Up Link: Built-in link to registration page
  • Responsive Design: Works on all screen sizes
  • Dark Mode Support: Automatic theme adaptation

Input Configuration

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

Example custom inputs:

const customInputs = [
  {
    id: "username",
    type: "text",
    label: "Username",
    placeholder: "Enter username",
  },
  {
    id: "password",
    type: "password",
    label: "Password",
    placeholder: "Enter password",
  },
  { id: "remember", type: "checkbox", label: "Remember me" },
];

Styling

The component includes:

  • Full screen background: Gray background with centered card
  • Card shadow: Professional elevation effect
  • Rounded corners: Modern card appearance
  • Consistent spacing: Well-organized layout

Use Cases

Perfect for:

  • Business Applications: Professional login screens
  • SaaS Platforms: Clean authentication UI
  • Admin Dashboards: Secure access portals
  • Corporate Websites: Branded login experience
  • Simple Applications: Straightforward authentication