Feature Comparison
Data Display
Block
Compare features across multiple plans or products in a structured table format.
Preview
Full feature comparison table with categories
| Features | Free $0/month | Pro Popular $29/month | Enterprise Contact salesCustom |
|---|---|---|---|
| Limits | |||
| Users | 1 | 10 | Unlimited |
| Storage | 1 GB | 100 GB | Unlimited |
| API calls | 1,000/mo | 100,000/mo | Unlimited |
| Support | |||
| Email support | |||
| Priority support | |||
| Dedicated manager | |||
| Security | |||
| SSO/SAML | |||
| Audit logs | |||
| Custom roles | |||
Without Categories
Simple flat list of features
| Features | Free $0/month | Pro Popular $29/month |
|---|---|---|
| Projects | 3 | Unlimited |
| Collaborators | 1 | 10 |
| File uploads | ||
| Custom domain | ||
| Analytics | ||
| Priority support |
Simple Comparison
Quick two-column comparison
| Feature | Basic | Premium |
|---|---|---|
| Projects | 5 | Unlimited |
| Team members | 2 | 25 |
| Storage | 10 GB | 500 GB |
| Custom branding | ||
| API access | ||
| Analytics |
Product Comparison
Compare products or services
| Feature | Product A | Product B |
|---|---|---|
| Price | $299 | $499 |
| Warranty | 1 year | 3 years |
| Free shipping | ||
| Premium support | ||
| User rating | 4.2/5 | 4.8/5 |
FeatureComparison Props
FeatureComparison API reference
| Prop | Type | Default | Description |
|---|---|---|---|
plans* | ComparisonPlan[] | — | Array of plans/products to compare |
features* | ComparisonFeature[] | — | Array of features with values per plan |
showCategories | boolean | true | Group features by category |
stickyHeader | boolean | false | Make header sticky on scroll |
className | string | — | Additional CSS classes |
SimpleComparison Props
SimpleComparison API reference
| Prop | Type | Default | Description |
|---|---|---|---|
items* | Array<{feature, optionA, optionB}> | — | Comparison items |
headers | [string, string] | ['Option A', 'Option B'] | Column headers |
className | string | — | Additional CSS classes |
Types
Supporting type definitions
interface ComparisonPlan { id: string name: string description?: string price?: string | number priceLabel?: string // e.g., "/month" highlighted?: boolean // Emphasize this plan badge?: string // e.g., "Popular"}
interface ComparisonFeature { name: string category?: string // For grouping features tooltip?: string values: Record<string, boolean | string> // Keys match plan IDs, values can be: // - true: Show checkmark // - false: Show X // - string: Show custom text}Usage
Import and implementation examples
import { FeatureComparison, SimpleComparison } from '@/blocks/data-display/feature-comparison'
// Full feature comparison<FeatureComparison plans={[ { id: 'free', name: 'Free', price: 0, priceLabel: '/mo' }, { id: 'pro', name: 'Pro', price: 29, priceLabel: '/mo', highlighted: true, badge: 'Popular' }, { id: 'enterprise', name: 'Enterprise', price: 'Custom' }, ]} features={[ { name: 'Users', category: 'Limits', values: { free: '1', pro: '10', enterprise: 'Unlimited' } }, { name: 'Storage', category: 'Limits', values: { free: '1 GB', pro: '100 GB', enterprise: 'Unlimited' } }, { name: 'Priority support', category: 'Support', values: { free: false, pro: true, enterprise: true } }, ]} showCategories={true}/>
// Simple two-column comparison<SimpleComparison headers={['Basic', 'Pro']} items={[ { feature: 'Users', optionA: '5', optionB: 'Unlimited' }, { feature: 'Storage', optionA: '10 GB', optionB: '100 GB' }, { feature: 'Priority support', optionA: false, optionB: true }, ]}/>Features
Built-in functionality
- Multiple plans: Compare any number of plans or products
- Feature categories: Group related features together
- Value types: Support for boolean and text values
- Highlighted plans: Emphasize recommended options
- Badges: Add "Popular" or similar labels
- Simple mode: Quick two-column comparison
- Dark mode: Full dark mode support
Accessibility
Accessibility considerations
ARIA Attributes
Uses semantic table markup with proper headersCategory rows span columns appropriatelyCheck and X icons supplemented with visual stylingKeyboard Navigation
| Key | Action |
|---|---|
| Tab | Navigate to interactive elements |
| Arrow keys | Navigate table cells (with screen reader) |
Notes
- Table structure allows screen readers to announce row/column context
- Boolean values use icons with distinct colors, not color alone
- Highlighted columns have subtle background, not just border