Installation
Usage
import PrecisionCard from "@/components/ruixen/precision-card";
export default function App() {
return (
<PrecisionCard
badge="Premium"
title="Professional Plan"
subtitle="Everything you need to succeed"
description="Comprehensive solution for growing businesses with advanced features and dedicated support."
features={[
"Unlimited projects",
"Priority support",
"Advanced analytics",
"Custom integrations",
]}
price="$99/month"
primaryAction={{
label: "Get Started",
onClick: () => console.log("Primary action"),
}}
secondaryAction={{
label: "Learn More",
onClick: () => console.log("Secondary action"),
}}
/>
);
}
Props
| Prop | Type | Default | Description |
|---|
badge | string | - | Badge text (e.g., "Premium") |
title | string | - | Card title |
subtitle | string | - | Card subtitle |
description | string | - | Detailed description |
features | string[] | - | List of features |
price | string | - | Price display |
primaryAction | Action | - | Primary button config |
secondaryAction | Action | - | Secondary button config |
icon | ReactNode | - | Optional icon element |
className | string | - | Additional CSS classes |
Action Type
type Action = {
label: string;
onClick: () => void;
};
Features
- Badge Display: Highlight special status or category
- Rich Content: Title, subtitle, and description
- Feature Lists: Checkmark icon lists
- Pricing Display: Prominent price section
- Dual Actions: Primary and secondary buttons
- Icon Support: Optional icon display
- Responsive Design: Mobile-first layout
- Dark Mode: Theme-aware styling
Card Sections
- Badge: Colored badge at top
- Icon: Optional icon display
- Title: Large, bold heading
- Subtitle: Muted subheading
Content
- Description: Paragraph text
- Features: Bulleted list with icons
- Spacing: Consistent vertical rhythm
- Price: Prominent pricing display
- Actions: Button group
- Layout: Stacked on mobile, row on desktop
Customization
With Icon
import { Zap } from "lucide-react";
<PrecisionCard
icon={<Zap className="w-8 h-8 text-primary" />}
badge="Fast"
title="Lightning Plan"
// ... other props
/>;
Custom Badge Colors
// Modify badge styling
<Badge className="bg-blue-500 text-white">
New
</Badge>
<Badge className="bg-green-500 text-white">
Popular
</Badge>
Long Feature Lists
features={[
"Unlimited projects and workspaces",
"Advanced analytics and reporting",
"Priority 24/7 customer support",
"Custom domain and branding",
"API access and webhooks",
"Team collaboration tools",
"Advanced security features",
"Dedicated account manager",
]}
Without Price
<PrecisionCard
title="Enterprise"
description="Custom pricing for large teams"
// No price prop
primaryAction={{
label: "Contact Sales",
onClick: handleContact,
}}
/>
Styling
Card Layout
- Max Width: 400px
- Padding: 6 (p-6)
- Border: Subtle border
- Radius: Rounded corners (lg)
- Shadow: Elevated appearance
Badge
- Position: Top of card
- Size: Small (sm)
- Colors: Primary theme color
- Margin: Bottom spacing
Feature List
- Icons: Check circle icons
- Color: Success green
- Spacing: Consistent gaps
- Text: Small, readable
- Primary: Solid background
- Secondary: Outline style
- Width: Full width on mobile
- Hover: Interactive feedback
Feature Icons
Default Icons
- Icon: CheckCircle from Lucide
- Color: Green (success)
- Size: 16px
- Position: Left of text
Custom Icons
import { Star, Check, Zap } from "lucide-react";
// Modify in component to use different icons
Use Cases
- Pricing Cards: Display plan features
- Product Cards: Showcase product details
- Service Packages: Present service offerings
- Subscription Tiers: Membership levels
- Feature Comparison: Compare offerings
- Upgrade Prompts: Encourage upgrades
Examples
SaaS Pricing
<PrecisionCard
badge="Most Popular"
title="Professional"
subtitle="For growing teams"
description="All the tools you need to scale your business"
features={[
"Up to 50 team members",
"Unlimited projects",
"Advanced analytics",
"Priority support",
"Custom integrations",
]}
price="$49/month"
primaryAction={{
label: "Start Free Trial",
onClick: () => router.push("/signup"),
}}
secondaryAction={{
label: "View Demo",
onClick: () => setShowDemo(true),
}}
/>
Service Package
import { Briefcase } from "lucide-react";
<PrecisionCard
icon={<Briefcase className="w-8 h-8 text-blue-500" />}
badge="Business"
title="Consulting Package"
subtitle="Expert guidance"
description="Get personalized consulting from industry experts"
features={[
"10 hours of consulting",
"Strategy development",
"Implementation support",
"Follow-up sessions",
]}
price="$2,500"
primaryAction={{
label: "Book Consultation",
onClick: handleBooking,
}}
/>;
Enterprise Plan
import { Building } from "lucide-react";
<PrecisionCard
icon={<Building className="w-8 h-8 text-purple-500" />}
badge="Enterprise"
title="Custom Solution"
subtitle="Tailored for your needs"
description="Enterprise-grade solution with dedicated support"
features={[
"Unlimited everything",
"Dedicated account manager",
"Custom SLA",
"On-premise deployment",
"Advanced security",
"Custom integrations",
]}
price="Contact us"
primaryAction={{
label: "Schedule Demo",
onClick: handleDemo,
}}
secondaryAction={{
label: "Download Brochure",
onClick: handleDownload,
}}
/>;
- Static Content: Pre-rendered at build
- Minimal JavaScript: Lightweight component
- Efficient Rendering: Optimized updates
- Fast Load: Quick initial paint
Accessibility
- Keyboard Navigation: Full keyboard support
- Screen Readers: Descriptive labels
- Focus Management: Clear focus indicators
- ARIA Labels: Proper accessibility
- Color Contrast: WCAG AA compliant
- Touch Targets: Minimum 44x44px
- Semantic HTML: Proper heading hierarchy