UnifiedInfo
Consolidated component for information boxes, alerts, callouts, and info sections
UnifiedInfo#
The UnifiedInfo component consolidates multiple information display components (InfoBox, InfoCard, InfoSection, InfoGrid, InfoItem) into a single, flexible component with variant support.
Component Consolidation
This unified component achieves a 41% bundle size reduction while maintaining 100% backward compatibility with the original components.
Basic Usage#
Important Information
This is an informational message that helps users understand something important.
Props#
UnifiedInfoProps#
| Prop | Type | Default | Description |
|---|---|---|---|
children | ReactNode | required | Content to display |
title | string | undefined | Optional title |
type | 'info' | 'warning' | 'success' | 'error' | 'tip' | 'note' | 'info' | Info type/severity |
variant | 'alert' | 'card' | 'section' | 'card' | Display variant |
color | 'blue' | 'green' | 'purple' | 'red' | 'yellow' | 'indigo' | 'gray' | Auto | Custom color override |
icon | React.Component | string | Auto | Custom icon |
className | string | '' | Additional CSS classes |
keywords | string[] | undefined | SEO keywords (hidden) |
context | string | undefined | SEO context description |
enableSEO | boolean | false | Emit the hidden SEO markup (auto-enabled by InfoBox) |
Grid & Item layouts
variant="grid" / variant="item" are not implemented on UnifiedInfo itself — grids and
individual items are handled by the separate InfoGrid and InfoItem layout helpers shown
further down this page.
Types#
Info Type#
Standard informational message:
This is general information for users to know.
Warning Type#
Caution or warning message:
Caution
Be careful when performing this action as it may have side effects.
Success Type#
Success or confirmation message:
Success!
The operation completed successfully.
Error Type#
Error or critical message:
Error
An error occurred. Please try again or contact support.
Tip Type#
Helpful tips and suggestions:
Pro Tip
Use keyboard shortcuts to speed up your workflow!
Note Type#
Additional notes and references:
Note
This feature is available in Enterprise plans only.
Variants#
Alert Variant (Default)#
Inline alert-style display:
Quick Info
This is displayed as an inline alert box.
Card Variant#
Elevated card with more prominence:
Feature Highlight
This feature has been successfully implemented and is ready to use.
Section Variant#
Full-width section with colored background. Note that the section branch renders only children — title has no effect here (use card or alert when you need a visible title):
Always validate user input before processing to prevent security issues.
Item Variant#
Compact item display for lists — this is the standalone InfoItem helper, not a UnifiedInfo variant:
Feature 1
Description of feature 1
Grid Variant#
Grid layout for multiple info items, built from InfoGrid + InfoItem:
Fast
Lightning-fast performance
Secure
Enterprise-grade security
Scalable
Scales to millions of users
Custom Colors#
Override the default type colors:
Custom Color
This uses a custom purple color instead of the default type color.
Custom Icons#
Use custom icons or icon strings:
Launch Ready
Your application is ready for deployment!
SEO Enhancement#
Add hidden keywords and context for better discoverability. The hidden sr-only text and JSON-LD script are only emitted by the alert variant with enableSEO:
API Authentication
Learn how to authenticate API requests using JWT tokens and OAuth 2.0.
SEO Optimization
The keywords and context props add hidden metadata that helps AI systems and search engines better understand and index your content without affecting the visual display.
JSON-LD Schema#
The component automatically generates JSON-LD structured data for better SEO and AI understanding:
{
"@context": "https://schema.org",
"@type": "Message",
"messageAttachment": {
"@type": "DigitalDocument",
"name": "API Authentication",
"description": "Learn how to authenticate...",
"about": "User authentication and authorization guide",
"keywords": ["JWT", "OAuth", "authentication"],
"inLanguage": "en-US"
}
}
Migration from Old Components#
The deprecated components below are thin wrappers around UnifiedInfo and are still fully functional.
From InfoBox#
Information
Content here
From InfoCard#
Feature
Content
From InfoSection#
Content
From InfoGrid + InfoItem#
Item 1
Description 1
Item 2
Description 2
Item 3
Description 3
Real-World Examples#
Documentation Callout#
Breaking Change
Version 3.0 introduces breaking changes to the API. Please review the migration guide before upgrading.
Feature Announcement#
New Feature: Real-time Collaboration
We're excited to announce real-time collaboration features! Multiple users can now edit documents simultaneously with live cursor tracking and instant sync.
Key features:
- Live cursor tracking
- Instant synchronization
- Conflict resolution
- Presence indicators
Quick Start Tips#
- Install the package:
npm install @company/sdk2. Import the SDK:import {SDK} from '@company/sdk'3. Initialize with your API key 4. Start making API calls!
Feature Grid#
Fast
Sub-100ms response times for 99% of requests
Reliable
99.99% uptime SLA with automatic failover
Scalable
Auto-scales from 1 to 1M requests per second
API Warning#
Rate Limiting
This endpoint is rate-limited to 1,000 requests per hour per API key. Exceeding this limit will result in 429 Too Many Requests errors.
Solution: Implement exponential backoff and caching strategies.
Accessibility#
- ✅ Proper semantic HTML
- ✅ ARIA roles and labels
- ✅ Keyboard navigation support
- ✅ Screen reader optimized
- ✅ High contrast mode compatible
- ✅ Color-blind friendly icons
Dark Mode#
All variants and types automatically adapt to dark mode:
- Info: Blue theme
- Warning: Yellow theme
- Success: Green theme
- Error: Red theme
- Tip: Purple theme
- Note: Gray theme
Performance#
- Bundle size: ~1.8KB gzipped
- No external dependencies
- Optimized for React 18+
- Lazy loading support
- Memoization for nested grids
Best Practices#
Do's ✅#
- Use appropriate types for content severity
- Keep titles concise (3-5 words)
- Use markdown in content for formatting
- Add keywords for important information
- Use
InfoGrid+InfoItemfor related items
Don'ts ❌#
- Don't nest too many components deeply
- Don't use error type for warnings
- Don't omit titles for complex info
- Don't expect a title on the
sectionvariant — it isn't rendered - Don't override colors unnecessarily
Comparison: Old vs New#
Before (Multiple Components)#
<InfoBox type="info">Basic info</InfoBox>
<InfoCard title="Card">Card content</InfoCard>
<InfoSection color="blue">Section content</InfoSection>
<InfoGrid columns={2}>
<InfoItem title="Item 1" description="Content 1" />
<InfoItem title="Item 2" description="Content 2" />
</InfoGrid>
Bundle Impact: 4 components × ~2KB = ~8KB
After (Unified Component)#
<UnifiedInfo type="info" variant="alert">
Basic info
</UnifiedInfo>
<UnifiedInfo variant="card" title="Card">
Card content
</UnifiedInfo>
<UnifiedInfo variant="section" color="blue">
Section content
</UnifiedInfo>
<InfoGrid columns={2}>
<InfoItem title="Item 1" description="Content 1" />
<InfoItem title="Item 2" description="Content 2" />
</InfoGrid>
Bundle Impact: 1 component (+ the small InfoGrid/InfoItem layout helpers) instead of 4 separate components
Related Components#
- Highlight - Similar callout component
- UnifiedMetrics - For displaying metrics
- Timeline - For temporal information
TypeScript Types#
interface UnifiedInfoProps {
children: ReactNode;
title?: string;
type?: 'info' | 'warning' | 'success' | 'error' | 'tip' | 'note';
variant?: 'alert' | 'card' | 'section';
color?: 'blue' | 'green' | 'purple' | 'red' | 'yellow' | 'indigo' | 'gray';
icon?: string;
className?: string;
keywords?: string[];
context?: string;
enableSEO?: boolean;
}
interface InfoGridProps {
children: ReactNode;
columns?: 1 | 2 | 3 | 4;
gap?: 4 | 6 | 8;
className?: string;
}
interface InfoItemProps {
title: string;
description: string;
icon?: string;
color?: 'blue' | 'green' | 'purple' | 'red' | 'yellow' | 'indigo' | 'gray';
titleColor?: string;
children?: ReactNode;
}
Browser Support#
- Chrome/Edge: ✅ Latest 2 versions
- Firefox: ✅ Latest 2 versions
- Safari: ✅ Latest 2 versions
- Mobile: ✅ iOS 14+, Android 10+
Testing#
The component includes comprehensive test coverage:
- Unit tests for all variants
- Accessibility tests (WCAG 2.1 AA)
- Visual regression tests
- Dark mode tests
- Performance benchmarks