0.04K

Install and configure shadcn-ember for Vite using the CLI.

Create project

Start by creating a new Ember project using the official blueprint:

pnpm dlx ember-cli@latest new my-app --typescript

Add Tailwind CSS

Install Tailwind CSS v4:

pnpm install tailwindcss @tailwindcss/vite

Create a app/app.css file with the following content:

app/app.css
@import 'tailwindcss';

Import the CSS file in app/app.ts :

app/app.ts
import './app.css';

Edit tsconfig.json file

Add the paths property to the compilerOptions section of the tsconfig.json file:

tsconfig.json
{
  "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 :

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:

pnpm install -D unplugin-icons @iconify-json/lucide

Add the plugin to your vite.config.mjs :

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:

pnpm dlx shadcn-ember@latest init

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? › yes

Set up ESLint plugin

shadcn-ember ships an ESLint plugin that catches common mistakes. Install it and add the recommended config:

pnpm install -D shadcn-ember
eslint.config.mjs
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:

pnpm dlx shadcn-ember@latest add button

The command above will add the Button component to your project. You can then import it like this:

gts
app/templates/application.gts
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>