1. Planning Phase
- Identify required interactive functionality
- Plan component structure (single component per page)
- Determine HTML content structure
2. Component Development
- Create MDX component file in
components/directory - Implement all requested functionality
- Use
useData()hook for persistent state - Test component behavior
3. HTML Page Creation
- Create HTML page with Tiptap-compliant content
- Embed component using
<mdx-component>element - Ensure proper content structure and formatting
4. Testing & Refinement
- Verify component embedding works correctly
- Test data persistence across sessions
- Ensure responsive design and accessibility
Common App Patterns
Dashboard Apps
Form-Based Apps
Data Visualization Apps
Best Practices
Component Design
- Start Simple: Begin with basic functionality, add complexity gradually
- Single Responsibility: Each component should handle one main purpose
- Data Isolation: Use
useData()for persistence, local state for temporary data - Error Handling: Implement proper error states and user feedback
Performance Considerations
- Lazy Loading: Load heavy components only when needed
- Data Caching: Use
useData()effectively to avoid unnecessary re-renders - Component Optimization: Keep components focused and lightweight
Accessibility
- Semantic HTML: Use proper HTML structure within components
- ARIA Labels: Provide proper labels for interactive elements
- Keyboard Navigation: Ensure all interactive elements are keyboard accessible
- Color Contrast: Follow accessibility guidelines for color usage
Troubleshooting
Common Issues
Component Not Rendering
- Check
data-pathmatches component file path exactly - Ensure component file exists in
components/directory - Verify component syntax and export statements
Data Not Persisting
- Use
useData()hook correctly - Check
updateData()calls include spread operator for existing data - Verify component data scope isolation
Styling Issues
- Use only Tailwind classes from the safelist
- Check for conflicting CSS classes
- Ensure proper responsive design classes
HTML Validation Errors
- Follow Tiptap schema strictly
- Remove unsupported HTML tags
- Use proper nesting for lists and block elements

