Components/Authentication
AuthCard
Flexible card component designed for authentication forms and flows
A flexible card component designed specifically for authentication forms and flows. It provides a consistent structure with optional header, content area, and footer sections, making it ideal for login forms, signup flows, and other authentication-related UI.
AuthCard Demo
Flexible card component designed for authentication forms and flows.
Welcome Back
Sign in to your accountCreate Account
Join thousands of usersAlready have an account?
Password Reset
Installation
npx bigblocks add auth-cardImport
import { AuthCard } from 'bigblocks';Props
| Prop | Type | Required | Default | Description |
|---|---|---|---|---|
| children | ReactNode | Yes | - | Card content |
| title | string | No | - | Optional card title |
| subtitle | string | No | - | Optional card subtitle |
| footer | ReactNode | No | - | Optional footer content |
| variant | 'default' | 'outlined' | 'elevated' | No | 'default' | Card style variant |
| className | string | No | - | Additional CSS classes |
Basic Usage
import { AuthCard } from 'bigblocks';
export default function Example() {
return (
<AuthCard title="Welcome Back">
<form>
<input type="email" placeholder="Email" />
<input type="password" placeholder="Password" />
<button type="submit">Sign In</button>
</form>
</AuthCard>
);
}Advanced Usage
With Footer
import { AuthCard } from 'bigblocks';
import { Text, Link } from '@radix-ui/themes';
export default function LoginCard() {
return (
<AuthCard
title="Welcome Back"
subtitle="Sign in to your account"
footer={
<div style={{ textAlign: 'center' }}>
<Text size="2" color="gray">
Don't have an account? <Link href="/signup">Sign up</Link>
</Text>
</div>
}
variant="elevated"
>
<LoginForm onSuccess={(user) => console.log('Logged in:', user)} />
</AuthCard>
);
}Different Variants
import { AuthCard } from 'bigblocks';
export default function VariantExamples() {
return (
<div className="space-y-4">
{/* Default variant */}
<AuthCard title="Default Card" variant="default">
<p>Standard surface card with subtle background</p>
</AuthCard>
{/* Outlined variant */}
<AuthCard title="Outlined Card" variant="outlined">
<p>Classic card with border</p>
</AuthCard>
{/* Elevated variant */}
<AuthCard title="Elevated Card" variant="elevated">
<p>Surface card with shadow for emphasis</p>
</AuthCard>
</div>
);
}Multi-Step Form
import { AuthCard } from 'bigblocks';
import { useState } from 'react';
export default function MultiStepAuth() {
const [currentStep, setCurrentStep] = useState(1);
const totalSteps = 3;
return (
<AuthCard
title="Create Account"
subtitle={`Step ${currentStep} of ${totalSteps}`}
>
{currentStep === 1 && <EmailStep onNext={() => setCurrentStep(2)} />}
{currentStep === 2 && <PasswordStep onNext={() => setCurrentStep(3)} />}
{currentStep === 3 && <ProfileStep onComplete={() => console.log('Done!')} />}
</AuthCard>
);
}Common Patterns
Login Form
import { AuthCard, LoginForm } from 'bigblocks';
import { Link } from '@radix-ui/themes';
export function LoginPage() {
return (
<AuthCard
title="Sign In"
footer={
<div className="text-center">
<Link href="/forgot-password">Forgot password?</Link>
</div>
}
>
<LoginForm />
</AuthCard>
);
}Error State
import { AuthCard, ErrorDisplay } from 'bigblocks';
export function AuthWithError({ error }) {
return (
<AuthCard variant="outlined" title="Authentication Error">
<ErrorDisplay error={error} />
<LoginForm />
</AuthCard>
);
}Loading State
import { AuthCard } from 'bigblocks';
import { Spinner } from '@radix-ui/themes';
export function LoadingAuth() {
return (
<AuthCard title="Authenticating...">
<div className="flex justify-center p-8">
<Spinner size="3" />
</div>
</AuthCard>
);
}Custom Styling
import { AuthCard } from 'bigblocks';
export function StyledAuthCard() {
return (
<AuthCard
title="Custom Styled Card"
variant="elevated"
className="bg-gradient-to-br from-orange-50 to-orange-100"
>
<div className="space-y-4">
<p>This card has custom background styling</p>
<button className="btn-primary">Continue</button>
</div>
</AuthCard>
);
}Styling
AuthCard uses Radix Themes design tokens for consistent styling:
- Spacing: Uses
--space-6for consistent padding - Colors: Automatically adapts to the current theme
- Typography: Uses Radix heading and text components
- Shadows:
--shadow-6for elevated variant
Variant Styles
- default: Standard surface card with subtle background
- outlined: Classic card with border styling
- elevated: Surface card with shadow for emphasis and depth
Accessibility
- Uses semantic HTML structure with proper heading hierarchy
- Maintains keyboard navigation support
- Compatible with screen readers
- Proper ARIA attributes when needed
Best Practices
- Title Hierarchy: Use title for main heading, subtitle for supporting text
- Footer Content: Ideal for secondary actions, links, or disclaimers
- Variant Selection:
- Use
defaultfor most authentication forms - Use
outlinedfor secondary forms or nested cards - Use
elevatedfor primary actions or important forms
- Use
- Responsive Design: Card adapts to container width automatically
- Content Spacing: Use consistent spacing within card content
Troubleshooting
Card Not Centered
- Wrap AuthCard in a CenteredLayout component for page-level centering
- Check parent container width and centering styles
Styling Not Applied
- Ensure Radix Themes CSS is imported
- Check that BitcoinThemeProvider is wrapping your app
- Verify custom classes don't conflict with Radix styles
Content Overflow
- AuthCard handles responsive sizing automatically
- For very long content, consider pagination or scrollable areas
- Test on various screen sizes
Related Components
- AuthLayout - Full-page authentication layout
- CenteredLayout - Center content on page
- LoginForm - Complete login form
- SignupFlow - Multi-step signup process
- ErrorDisplay - Error message display
API Reference
Variant Types
'default'- Standard surface styling'outlined'- Border-based styling'elevated'- Shadow-enhanced styling
Layout Structure
The AuthCard component creates the following structure:
- Card container with variant styling
- Optional header with title/subtitle
- Main content area (children)
- Optional footer section
Integration
Works seamlessly with other BigBlocks components:
- Contains forms like
LoginForm,SignupFlow - Pairs with
AuthLayoutfor full-page layouts - Compatible with all authentication components
- Integrates with theme system automatically