Loading dashboard...
Loading dashboard...
Note: This guide is for Remix. For React Router, see the React Router guide.
Start by creating a new Remix project using create-remix:
Run the shadcn init command to setup your project:
You will be asked a few questions to configure components.json:
Which color would you like to use as base color? › NeutralNote: This app structure is only a suggestion. You can place the files wherever you want.
app/components/ui folder.app/components folder.app/lib folder contains all the utility functions. We have a utils.ts where we define the cn helper.app/tailwind.css file contains the global CSS.Then we create a postcss.config.js file:
export default {
plugins: {
tailwindcss: {},
autoprefixer: {},
},
}And finally we add the following to our remix.config.js file:
/** @type {import('@remix-run/dev').AppConfig} */
export default {
...
tailwind: true,
postcss: true,
...
};tailwind.css to your appIn your app/root.tsx file, import the tailwind.css file:
import styles from "./tailwind.css?url"
export const links: LinksFunction = () => [
{ rel: "stylesheet", href: styles },
...(cssBundleHref ? [{ rel: "stylesheet", href: cssBundleHref }] : []),
]You can now start adding components to your project.
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 (
<div>
<Button>Click me</Button>
</div>
)
}