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
Prop | Type | Default | Description |
---|---|---|---|
title | string | "Sign In" | Card title |
inputs | LoginInput[] | Email/password fields | Form input configuration |
buttonText | string | "Login" | Submit button text |
logo | React.ReactNode | - | Logo or icon to display |
className | string | - | 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