Postcard
Social-media-style post card with author, content, media embed, and engagement stat slots.
Overview
Purpose
The Postcard component social-media-style post card with author, content, media embed, and engagement stat slots.within our design system. It follows our composer layer principles, ensuring consistency and reusability across applications.
When to Use
- Use when you need component functionality
- Appropriate for textual contexts
- Follows composer component patterns
When Not to Use
- Avoid when simpler alternatives exist
- Don't use for inappropriate contexts
- Consider alternatives for edge cases
Live Example
Anatomy
Understanding the structure of the Postcard component helps ensure proper implementation and customization.
| Property | Description | Type |
|---|---|---|
| root | Slot rendered into [data-slot="postcard"]. | Root |
| post | Post region of the component. | Part |
| header | Slot rendered into [data-slot="postcard-header"]. | Slot |
| userInfo | User info region of the component. | Part |
| displayName | Display name region of the component. | Part |
| handle | Handle region of the component. | Part |
| timestamp | Slot rendered into [data-slot="postcard-timestamp"]. | Slot |
| content | Slot rendered into [data-slot="postcard-content"]. | Slot |
| footer | Slot rendered into [data-slot="postcard-footer"]. | Slot |
| stats | Slot rendered into [data-slot="postcard-stats"]. | Slot |
| stat | Slot rendered into [data-slot="postcard-stat"]. | Slot |
Variants & States
API Reference
Props
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
children | ReactNode | Yes | — | — |
postId | string | Yes | — | — |
author | PostcardContextType['author'] | Yes | — | — |
timestamp | string | Yes | — | — |
content | string | Yes | — | — |
embed | PostcardContextType['embed'] | No | — | — |
stats | PostcardContextType['stats'] | Yes | — | — |
Methods
| Name | Parameters | Returns | Description |
|---|---|---|---|
getRelativeTimeString | date: Date | number | void | — |
Accessibility
Standards Compliance
This component follows WCAG 2.1 AA guidelines and includes proper ARIA attributes, keyboard navigation, and screen reader support.
Accessibility Checklist
- ○ Keyboard navigation support
- ○ Screen reader compatibility
- ○ Color contrast compliance
- ○ Focus management
- ○ ARIA attributes
- ○ Reduced motion support
Usage Guidelines
Do
- Use consistent spacing and sizing
- Follow established patterns
- Provide clear labels and descriptions
- Test with assistive technologies
Don't
- Override core functionality
- Use without proper context
- Ignore accessibility requirements
- Modify without design system approval
Examples
Advanced Usage
Complex patterns including composition, state management, and real-world scenarios.
Development Tools
Use these tools to analyze the component's performance, design tokens, and accessibility during development.
Contribute
Help us improve the Postcard component documentation. Found an issue or have suggestions?