A modern, type-safe React Native design system built with performance and developer experience in mind. Features theme-based components, smooth animations, and pixel-perfect typography.
- 🎨 Theme System: Light/dark themes with full TypeScript support
- ⚡ Performance: Built on react-native-unistyles for optimal rendering
- 🎬 Animations: Smooth animations powered by react-native-reanimated
- 📝 Typography: Pixel-perfect text with Capsize integration
- ♿ Accessibility: Full accessibility support out of the box
- 🔧 Type Safety: Complete TypeScript coverage with theme augmentation
- 📱 React Navigation: Integrated components for navigation
npm install @lightbase/rn-design-systemThis package requires the following peer dependencies:
npm install react-native-unistyles react-native-reanimated react-native-safe-area-context react-native-gesture-handler react-native-keyboard-controllerFor navigation integration:
npm install @react-navigation/native @react-navigation/native-stack @react-navigation/bottom-tabs @react-navigation/elementsimport { createtheme } from '@lightbase/rn-design-system';
export const theme = createtheme({
colors: {
primary: '#007AFF',
secondary: '#5856D6',
background: '#FFFFFF',
surface: '#F2F2F7',
text: '#000000',
},
spacing: {
xs: 4,
sm: 8,
md: 16,
lg: 24,
xl: 32,
},
typography: {
fontFamily: 'Inter',
variants: {
heading: { fontSize: 24, fontWeight: '700' },
body: { fontSize: 16, fontWeight: '400' },
caption: { fontSize: 12, fontWeight: '400' },
}
}
});// App.tsx or your root component
import { UnistylesRegistry } from 'react-native-unistyles';
import { theme } from './theme';
UnistylesRegistry.addThemes({
light: theme.light,
dark: theme.dark,
}).addConfig({
adaptiveThemes: true,
});import React from 'react';
import { Screen, VStack, Text, Button } from '@lightbase/rn-design-system';
export default function HomeScreen() {
return (
<Screen>
<VStack spacing="lg" padding="md">
<Text variant="heading" color="primary">
Welcome to Design System
</Text>
<Text variant="body" color="text">
A modern React Native design system with excellent performance.
</Text>
<Button variant="solid" color="primary" onPress={() => {}}>
<Button.Text>Get Started</Button.Text>
</Button>
</VStack>
</Screen>
);
}Top-level screen container with safe area handling and navigation integration.
<Screen safeAreaEdges={['top', 'bottom']}>
{/* Your screen content */}
</Screen>Layout containers for vertical and horizontal arrangements with spacing.
<VStack spacing="md" align="center">
<Text>Item 1</Text>
<Text>Item 2</Text>
</VStack>
<HStack spacing="sm" align="center" justify="space-between">
<Text>Left</Text>
<Text>Right</Text>
</HStack>Themeable text component with variant support and Capsize integration.
<Text variant="heading" color="primary">
Heading Text
</Text>
<Text fontSize={16} fontWeight="600" color="text">
Custom Text
</Text>Animated button with multiple variants and loading states.
<Button variant="solid" color="primary" loading={isLoading}>
<Button.Text>Submit</Button.Text>
</Button>
<Button variant="outline" size="sm">
<Button.Text>Cancel</Button.Text>
</Button>// types/theme.ts
declare module '@lightbase/rn-design-system' {
interface CustomColors {
brand: string;
accent: string;
}
interface CustomSpacing {
xxs: number;
xxl: number;
}
}const customTheme = createtheme({
colors: {
// Standard colors
primary: '#007AFF',
secondary: '#5856D6',
background: '#FFFFFF',
surface: '#F2F2F7',
text: '#000000',
// Custom colors
brand: '#FF6B6B',
accent: '#4ECDC4',
},
spacing: {
xs: 4,
sm: 8,
md: 16,
lg: 24,
xl: 32,
// Custom spacing
xxs: 2,
xxl: 48,
},
typography: {
fontFamily: 'Inter',
variants: {
heading: { fontSize: 24, fontWeight: '700' },
subheading: { fontSize: 20, fontWeight: '600' },
body: { fontSize: 16, fontWeight: '400' },
caption: { fontSize: 12, fontWeight: '400' },
}
}
});import { createBox } from '@lightbase/rn-design-system';
const Card = createBox<'Pressable'>({
component: 'Pressable',
variants: {
elevated: {
shadowColor: '#000',
shadowOffset: { width: 0, height: 2 },
shadowOpacity: 0.1,
shadowRadius: 4,
elevation: 3,
}
}
});
// Usage
<Card variant="elevated" backgroundColor="surface" padding="md">
<Text>Card content</Text>
</Card>import { Screen } from '@lightbase/rn-design-system';
function ProfileScreen({ navigation }) {
return (
<Screen
navigationOptions={{
title: 'Profile',
headerRight: () => (
<Button variant="link" onPress={() => navigation.navigate('Settings')}>
<Button.Text>Settings</Button.Text>
</Button>
),
}}
>
{/* Screen content */}
</Screen>
);
}All components support theme-based props for consistent styling:
color: Theme color tokensbackgroundColor: Theme color tokenspadding,margin: Theme spacing tokensborderRadius: Theme border radius tokens
interface ThemeProps {
color?: ColorTokens;
backgroundColor?: ColorTokens;
padding?: SpacingTokens | SpacingObject;
margin?: SpacingTokens | SpacingObject;
borderRadius?: BorderRadiusTokens;
}This design system is built for performance:
- Unistyles: Compile-time style optimization
- Reanimated: 60fps animations on the UI thread
- Capsize: Efficient font rendering with minimal layout shifts
- Token-based: Consistent theming with minimal runtime overhead
Contributions are welcome! This is an internal design system for Lightbase, but we appreciate feedback and suggestions.
MIT
Oliver Winter owinter86@gmail.com
GitHub: @owinter86