- Accordion
- Alert
- Alert Dialog
- Aspect Ratio
- Avatar
- Badge
- Breadcrumb
- Button
- Button Group
- Calendar
- Card
- Carousel
- Chart
- Checkbox
- Collapsible
- Combobox
- Command
- Context Menu
- Data Table
- Date Picker
- Dialog
- Drawer
- Dropdown Menu
- Empty
- Field
- Form
- Hover Card
- Input
- Input Group
- Input OTP
- Item
- Kbd
- Label
- Menubar
- Native Select
- Navigation Menu
- Pagination
- Pin Input
- Popover
- Progress
- Radio Group
- Range Calendar
- Resizable
- Scroll Area
- Select
- Separator
- Sheet
- Sidebar
- Skeleton
- Slider
- Sonner
- Spinner
- Stepper
- Switch
- Table
- Tabs
- Tags Input
- Textarea
- Toast
- Toggle
- Toggle Group
- Tooltip
- Typography
Create project
Start by creating a new Nuxt project using create-nuxt-app:
pnpm create nuxt@latest
If you encounter the error ERROR: Cannot read properties of undefined (reading 'sys') (x4), please proceed to install TypeScript as a dependency, as advised in this issue
pnpm add -D typescript
Add Tailwind CSS
How to setup tailwindcss
pnpm add tailwindcss @tailwindcss/vite -D
Replace everything in app/assets/css/tailwind.css with the following:
@import "tailwindcss";Update nuxt.config.ts with the following:
import tailwindcss from '@tailwindcss/vite'
export default defineNuxtConfig({
// ...
css: ['~/assets/css/tailwind.css'],
vite: {
plugins: [
tailwindcss(),
],
},
})Add Nuxt module
Skipping this step triggers numerous console warnings due to Nuxt's auto-import feature.
Install the package below.
pnpm dlx nuxi@latest module add shadcn-nuxt
Configure nuxt.config.ts
export default defineNuxtConfig({
// ...
modules: ['shadcn-nuxt'],
shadcn: {
/**
* Prefix for all the imported component.
* @default "Ui"
*/
prefix: '',
/**
* Directory that the component lives in.
* Will respect the Nuxt aliases.
* @link https://nuxt.com/docs/api/nuxt-config#alias
* @default "@/components/ui"
*/
componentDir: '@/components/ui'
}
})Add a Nuxt Plugin for providing ssrWidth (optional)
Some components require a ssrWidth to be set through VueUse to avoid Hydration errors on mobile.
Add the following plugin to your Nuxt application: app/plugins/ssr-width.ts
Read more about useSSRWidth
import { provideSSRWidth } from '@vueuse/core'
export default defineNuxtPlugin((nuxtApp) => {
provideSSRWidth(1024, nuxtApp.vueApp)
})Run Nuxt Prepare
If you are initiating a new project, you need to run the command so that Nuxt generates the necessary .nuxt folder:
pnpm dlx nuxi prepare
Run the CLI
Run the shadcn-vue init command to setup your project:
pnpm dlx shadcn-vue@latest init
You will be asked a few questions to configure components.json.
Which color would you like to use as base color? › NeutralAdd Components
You can now start adding components to your project.
pnpm dlx shadcn-vue@latest add button
The command above will add the Button component to your project. Nuxt autoImport will handle importing the components, you can just use it as such:
<template>
<div>
<Button>Click me</Button>
</div>
</template>