Get Started
Components
- Alert
- Avatar
- Badge
- Breadcrumb
- Button
- Button Group
- Calendar
- Card
- Carousel
- Chart
- Checkbox
- Checkbox Group
- ComboBox
- Command
- Data Table
- Date Field
- Date Picker
- Date Range Picker
- Dialog
- Disclosure
- Disclosure Group
- Drawer
- Empty
- Field
- File Trigger
- Form
- Grid List
- Hover Card
- Input
- Input Group
- Input OTP
- Item
- Kbd
- Label
- ListBox
- Menu
- Number Field
- Pagination
- Popover
- Progress Bar
- Radio Group
- Range Calendar
- Resizable
- Search Field
- Select
- Separator
- Sheet
- Sidebar
- Skeleton
- Slider
- Sonner
- Spinner
- Switch
- Table
- Tabs
- Tag Group
- Text Field
- Textarea
- Time Field
- Toast
- Toggle Button
- Toggle Button Group
- Tooltip
- Tree
- Typography
AI Elements
Note: This guide is for Remix. For React Router, see the React Router guide.
Create project
Start by creating a new Remix project using create-remix:
pnpmnpmyarnbunpnpm dlx create-remix@latest my-app
Run the CLI
Run the shadcn init command to setup your project:
pnpmnpmyarnbunpnpm dlx shadcn@latest init
Configure components.json
You will be asked a few questions to configure components.json:
Which color would you like to use as base color? › NeutralApp structure
Note: This app structure is only a suggestion. You can place the files wherever you want.
- Place the UI components in the
app/components/uifolder. - Your own components can be placed in the
app/componentsfolder. - The
app/libfolder contains all the utility functions. We have autils.tswhere we define thecnhelper. - The
app/tailwind.cssfile contains the global CSS.
Install Tailwind CSS
pnpmnpmyarnbunpnpm add -D tailwindcss@latest autoprefixer@latest
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,
...
};Add tailwind.css to your app
In 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 }] : []),
]That's it
You can now start adding components to your project.
pnpmnpmyarnbunpnpm dlx shadcn@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 (
<div>
<Button>Click me</Button>
</div>
)
}