Installation
How to install and set up Lunar Kit in your React Native project
Installation
Get Lunar Kit up and running in your React Native project.
Quick Start (New Project)
The fastest way to get started is to create a new project with Lunar Kit pre-configured:
This will scaffold a new Expo project with:
- ✅ NativeWind configured
- ✅ Theme system set up
- ✅ Base utilities included
- ✅ TypeScript ready
After creation:
Adding to Existing Project
If you have an existing React Native project, follow these steps:
1. Install the CLI
2. Initialize Lunar Kit
Run the init command in your project root:
This will:
- Create
src/components/uidirectory - Set up
lib/utils.tswith helper functions - Install required dependencies
- Create configuration file
3. Install NativeWind (if not already installed)
Lunar Kit requires NativeWind v4. If you haven't set it up:
Create tailwind.config.js:
Create global.css:
4. Configure Metro
Update metro.config.js:
5. Configure Babel
Update babel.config.js:
6. Add TypeScript Declarations
Create nativewind-env.d.ts:
7. Import Global CSS
In your root layout or App.tsx:
Adding Components
Once initialized, use the CLI to add components:
Components will be added to src/components/ui/.
Required Dependencies
Lunar Kit components may require these peer dependencies:
Path Aliases
We recommend setting up path aliases for cleaner imports.
For Expo
In tsconfig.json:
In babel.config.js:
Don't forget to install the plugin:
Utility Functions
The utils.ts file provides essential helper functions:
The cn function combines clsx and tailwind-merge to handle conditional classes and merge Tailwind classes properly.
Project Structure
After setup, your project should look like:
Verification
To verify everything is working:
Run the app:
Troubleshooting
Styles not applying
- Make sure you imported
global.cssin your root layout - Clear Metro cache:
pnpm start --clear - Restart the development server
TypeScript errors
- Ensure
nativewind-env.d.tsis in your project root - Restart TypeScript server in VS Code
Component not found
- Check that the component was added correctly to
src/components/ui/ - Verify path aliases are configured correctly
Next, learn about Theme Configuration to customize the look of your app!