Files
shadcn-ui/apps/v4/content/docs/installation/remix.mdx
shadcn 1aa35048a5 feat: v4 updates (#7499)
* feat(v4): update home page

* fix

* fix: cards

* feat(v4): charts page

* feat: update pages

* feat: colors

* fix

* feat: add docs

* feat: mdx work

* fix

* fix

* fix: sidebar

* fix: lint

* feat: updates

* feat: update components

* feat: fix docs

* fix: responsive

* feat: implement cmdk

* fix: update navigation menu demo

* fix: code style

* fix: themes

* feat: implement blocks page

* fix: docs config

* refactor

* fix: outputFileTracingIncludes

* fix

* fix: output

* fix

* fix: registry

* refactor: move docs

* debug: docs

* debug

* revert

* fix: mjs

* deps: pin fumadocs

* debug

* fix: downgrade next

* fix: index page

* refactor: move mdx components

* fix: remove copy button

* fix

* was it zod

* yes it was

* remove copy page

* fix: color page

* fix: colors page

* fix: meta colors

* fix: copy button

* feat: sync registry

* fix: registry build script

* feat: update port

* feat: clean up examples

* fix

* fix: mobile nav

* fix: blur for mobile

* fix: sidebar nav

* feat: update examples

* fix: build scripts

* feat: update components

* feat: restyle

* fix: types

* fix: styles

* fix: margins

* fix: screenshots

* fix

* feat: update theme

* fix: charts nav

* fix: image

* feat: optimize images

* fix: menu

* fix: card

* fix: border

* check

* feat: implement charts page

* fix: charts

* fix: og images

* feat: extend touch

* fix: static

* fix: sizing

* fix: mobile screenshots

* fix: page nav

* fix

* feat: update favicon

* fix: theme selector

* fix: feedback

* fix: sink

* docs: update

* fix: styles

* chore: update registry

* fix: command

* fix

* fix: minor updates

* fix: typography on smaller devices

* fix: format

* fix: remove unused icon

* feat: update favicon

* fix: typography

* docs: typography page

* fix: steps
2025-05-30 11:35:16 +04:00

116 lines
2.3 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
---
title: Remix
description: Install and configure shadcn/ui for Remix.
---
<Callout>
**Note:** This guide is for Remix. For React Router, see the [React Router](/docs/installation/react-router) guide.
</Callout>
<Steps>
### Create project
Start by creating a new Remix project using `create-remix`:
```bash
npx create-remix@latest my-app
```
### Run the CLI
Run the `shadcn` init command to setup your project:
```bash
npx shadcn@latest init
```
### Configure components.json
You will be asked a few questions to configure `components.json`:
```bash
Which color would you like to use as base color? Neutral
```
### App structure
<Callout>
**Note**: This app structure is only a suggestion. You can place the files wherever you want.
</Callout>
- Place the UI components in the `app/components/ui` folder.
- Your own components can be placed in the `app/components` folder.
- The `app/lib` folder contains all the utility functions. We have a `utils.ts` where we define the `cn` helper.
- The `app/tailwind.css` file contains the global CSS.
### Install Tailwind CSS
```bash
npm install -D tailwindcss@latest autoprefixer@latest
```
Then we create a `postcss.config.js` file:
```js title="postcss.config.js" showLineNumbers
export default {
plugins: {
tailwindcss: {},
autoprefixer: {},
},
}
```
And finally we add the following to our `remix.config.js` file:
```js title="remix.config.js" {4-5} showLineNumbers
/** @type {import('@remix-run/dev').AppConfig} */
export default {
...
tailwind: true,
postcss: true,
...
};
```
### Add `tailwind.css` to your app
In your `app/root.tsx` file, import the `tailwind.css` file:
```js {1, 4} showLineNumbers title="app/root.tsx"
import styles from "./tailwind.css?url"
export const links: LinksFunction = () => [
{ rel: "stylesheet", href: styles },
...(cssBundleHref ? [{ rel: "stylesheet", href: cssBundleHref }] : []),
]
```
### That's it
You can now start adding components to your project.
```bash
npx shadcn@latest add button
```
The command above will add the `Button` component to your project. You can then import it like this:
```tsx {1,6} showLineNumbers title="app/routes/index.tsx"
import { Button } from "~/components/ui/button"
export default function Home() {
return (
<div>
<Button>Click me</Button>
</div>
)
}
```
</Steps>