MCPcopy Index your code
hub / github.com/EvanBacon/expo-shadcn-ui-demo

github.com/EvanBacon/expo-shadcn-ui-demo @main

Chat with this repo
repository ↗ · DeepWiki ↗ · + Follow
11 symbols 55 edges 18 files 0 documented · 0% updated 2y ago★ 105
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

Expo Router v3 shadcn-ui demo

This is a web-only guide for setting up Tailwind CSS and Shadcn UI in an Expo Router v3 project.

Setup Tailwind

Install dependencies:

yarn add tailwindcss postcss autoprefixer

Create a tailwind.config.js file:

/** @type {import('tailwindcss').Config} */
module.exports = {
  content: ["./src/app/**/*.{ts,tsx}", "./src/components/**/*.{ts,tsx}"],
  // Not required but I recommend disabling hover effects on touch devices.
  future: {
    hoverOnlyWhenSupported: true,
  },
};

Add a postcss.config.js config file:

module.exports = {
  plugins: {
    autoprefixer: {},
    tailwindcss: {},
  },
};

Create a global CSS file at src/global.css:

@tailwind base;
@tailwind components;
@tailwind utilities;

Import the global CSS file in your root layout src/app/_layout.tsx:

import "../global.css";

Setup Shadcn UI

Run the shadcn-ui init command to setup your project:

npx shadcn-ui@latest init

You will be asked a few questions to configure components.json:

Would you like to use TypeScript (recommended)? no / yes
Which style would you like to use? › Default
Which color would you like to use as base color? › Slate
Where is your global CSS file? › src/global.css
Do you want to use CSS variables for colors? › no / yes
Where is your tailwind.config.js located? › tailwind.config.js
Configure the import alias for components: › ~/components
Configure the import alias for utils: › ~/lib/utils
Are you using React Server Components? › no

Usage

Now you can install and add components to your project:

npx shadcn-ui@latest add button

The command above will add the Button component to your project. You can then import it like this:

import { Button } from "@/components/ui/button";

export default function Home() {
  return (



      <Button>Click me</Button>



  );
}

Reminder: Shadcn UI does not work on native, so you'll need to ensure you don't load any Shadcn UI components on native. You can use the Platform module to do this. Learn more: Platform-specific modules.

  • Example application with native https://github.com/EvanBacon/expo-router-better-web-drawers-example

Extension points exported contracts — how you extend this code

ButtonProps (Interface)
(no doc)
src/components/ui/button.tsx

Core symbols most depended-on inside this repo

cn
called by 20
src/lib/utils.ts
Overview
called by 0
src/components/overview.tsx
CalendarDateRangePicker
called by 0
src/components/date-range-picker.tsx
Header
called by 0
src/components/header.tsx
Calendar
called by 0
src/components/ui/calendar.tsx
DashboardPage
called by 0
src/app/customers.tsx
RootLayout
called by 0
src/app/_layout.tsx
NotFoundScreen
called by 0
src/app/+not-found.tsx

Shape

Function 10
Interface 1

Languages

TypeScript100%

Modules by API surface

src/lib/utils.ts1 symbols
src/components/ui/calendar.tsx1 symbols
src/components/ui/button.tsx1 symbols
src/components/overview.tsx1 symbols
src/components/header.tsx1 symbols
src/components/date-range-picker.tsx1 symbols
src/app/products.tsx1 symbols
src/app/index.tsx1 symbols
src/app/customers.tsx1 symbols
src/app/_layout.tsx1 symbols
src/app/+not-found.tsx1 symbols

For agents

$ claude mcp add expo-shadcn-ui-demo \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page