Modern Copy-Paste UI Components for React Native – Nativecn

Description:

NativeCN is a React Native UI component library inspired by shadcn/ui that lets you add beautifully designed, accessible components to your app.

This library takes the copy-paste approach that made shadcn/ui popular in the React ecosystem and adapts it specifically for React Native development.

Features

  • Copy-paste: Components delivered as source code rather than npm packages for maximum flexibility.
  • NativeWind integration: Built-in preset system for consistent theming across your application.
  • Dual styling support: Compatible with both NativeWind and traditional React Native StyleSheet approaches.
  • TypeScript foundation: Complete type safety for better development experience and fewer runtime errors.
  • Non-intrusive setup: Clean installation process that respects your existing project structure.
  • Customizable components: Full access to component source code enables unlimited customization possibilities.

How to Use It

1. To get started, make sure you have NativeWind installed and configured in your project.

2. Initialize NativeCN:

npx @nativecn/cli init

3. You can now add any available component you need with the add command. For example, to add an accordion component.

npx @nativecn/cli add accordion

4. You can then import it and use it just like any other local component.

import { Accordion, AccordionItem, AccordionTrigger, AccordionContent } from '../components/ui/accordion';
import { useColorScheme } from 'react-native';

export function FAQSection() {
const colorScheme = useColorScheme();

return (
<Accordion
type="single"
collapsible
mode={colorScheme} // 'light' or 'dark' based on system preference
>
<AccordionItem id="faq-1">
<AccordionTrigger>Question 1</AccordionTrigger>
<AccordionContent>Answer to question 1</AccordionContent>
</AccordionItem>
<AccordionItem id="faq-2">
<AccordionTrigger>Question 2</AccordionTrigger>
<AccordionContent>Answer to question 2</AccordionContent>
</AccordionItem>
</Accordion>
);
}

5. The library currently includes Accordion, Alert, Alert Dialog, Aspect Ratio, Avatar, Badge, Breadcrumb, Button, Card, Carousel, OTP Input, and Skeleton components. The development team maintains an active roadmap showing progress across different component categories, with 12 of 46 planned components currently available.

Add Comment