Philosophy
The design system is built on several core principles:- Type Safety: All components are written in TypeScript with full type definitions
- Cross-Platform: Components work seamlessly on iOS, Android, and Web
- Performance: Optimized for React Native with careful attention to rendering performance
- Composability: Components are designed to work together elegantly
- Design Tokens: Consistent spacing, typography, and colors across the app
Architecture
The design system is organized into several layers:Layout Components
Primitive layout components for building flexible UIs:- Box - The foundational layout primitive with flexbox properties
- Stack - Vertical layouts with consistent spacing
- Inline - Horizontal/wrapping layouts with consistent spacing
- Columns - Equal-width column layouts
- Rows - Equal-height row layouts
- Inset - Container with padding
- Cover - Absolutely positioned overlay
Typography
Text rendering components with precise typography control:- Text - Primary text component with size and weight variants
- Heading - Heading component (deprecated, use Text instead)
- MarkdownText - Markdown rendering support
Design Tokens
The design system uses a comprehensive token system:- Space: Consistent spacing values (2px, 4px, 8px, 12px, 16px, 20px, 24px, etc.)
- Typography: SF Pro Rounded font family with multiple weights
- Colors: Semantic color palettes with dark mode support
- Shadows: Predefined shadow tokens for depth
Getting Started
Installation
The design system is part of the Rainbow monorepo:Basic Example
Development
Design System Playground
Rainbow includes a design system playground for component development and testing:Adding New Components
When adding a new component:- Create the component in
src/design-system/components/ - Add a corresponding
*.docs.tsxfile - Import it in the main Playground component
- For new text sizes, validate spacing on both iOS and Android
Resources
- Live Documentation: https://rds-jxom.vercel.app
- Source Code:
src/design-system/ - Playground:
src/design-system/playground/
Next Steps
- Layout Components - Learn about Box, Stack, and other layout primitives
- Typography - Understand the typography system
- Styling Approach - Learn about styled-thing