Install and configure shadcn-ember for Vite using the CLI.
Create project
Start by creating a new Ember project using the official blueprint:
Add Tailwind CSS
Install Tailwind CSS v4:
Create a
app/app.css
file with the following content:
@import 'tailwindcss';
Import the CSS file in
app/app.ts
:
import './app.css';Edit tsconfig.json file
Add the
paths
property to the
compilerOptions
section of the
tsconfig.json
file:
{
"compilerOptions": {
"paths": {
"@/*": ["./app/*"]
}
}
}
The
@
alias is a preference. You can use other aliases if you want.
Update vite.config.mjs
Add the Tailwind CSS plugin and path aliases to your
vite.config.mjs
:
import path from 'path';
import { defineConfig } from 'vite';
import { extensions, classicEmberSupport, ember } from '@embroider/vite';
import { babel } from '@rollup/plugin-babel';
import tailwindcss from '@tailwindcss/vite';
export default defineConfig({
plugins: [
classicEmberSupport(),
ember(),
babel({
babelHelpers: 'runtime',
extensions,
}),
tailwindcss(),
],
resolve: {
alias: {
'@': path.resolve(__dirname, './app'),
},
},
});Configure icons
shadcn-ember uses
unplugin-icons
for icon support. Install the dependencies:
Add the plugin to your
vite.config.mjs
:
import path from 'path';
import { defineConfig } from 'vite';
import { extensions, classicEmberSupport, ember } from '@embroider/vite';
import { babel } from '@rollup/plugin-babel';
import tailwindcss from '@tailwindcss/vite';
import Icons from 'unplugin-icons/vite';
export default defineConfig({
plugins: [
classicEmberSupport(),
ember(),
babel({
babelHelpers: 'runtime',
extensions,
}),
tailwindcss(),
Icons({ compiler: 'ember' }),
],
resolve: {
alias: {
'@': path.resolve(__dirname, './app'),
},
},
});Import icons like this:
import Check from '~icons/lucide/check';Run the CLI
Run the
shadcn-ember
init command to setup your project:
You will be asked a few questions to configure
components.json
:
Which style would you like to use? › New York
Which color would you like to use as base color? › Neutral
Do you want to use CSS variables for colors? › yesSet up ESLint plugin
shadcn-ember ships an ESLint plugin that catches common mistakes. Install it and add the recommended config:
import { configs as shadcnEmberConfigs } from 'shadcn-ember/eslint';
export default [
// ...your other config
...shadcnEmberConfigs.recommended,
];See the ESLint Plugin page for more details.
Add Components
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';
<template>
<div class="flex min-h-svh flex-col items-center justify-center">
<Button>Click me</Button>
</div>
</template>