Lesson 1. React+Vite+TS+Shadcn Project

Vite React app with Tailwind CSS and shadcn

Install and configure shadcn/ui for Vite React App.

Note

Note: The following guide is for Tailwind v4. If you are using Tailwind v3, use [email protected].

Step 1. Create a Vite React App project

Start by creating a new React project using vite. Select the React + TypeScript template:

npm create vite@latest

  Project name:
  bible-flashcard-app

  Select a framework:
  React

  Select a variant:
  TypeScript

Step 2. cd to bible-flashcard-app

Add Tailwind CSS

Replace everything in src/index.css with the following:

Step 3. Open VSC and Edit tsconfig.json file

The current version of Vite splits TypeScript configuration into three files, two of which need to be edited. Add the baseUrl and paths properties to the compilerOptions section of the tsconfig.json and tsconfig.app.json files:

Step 4. Edit tsconfig.app.json file

Add the following code to the tsconfig.app.json file to resolve paths, for your IDE:

Step 5. Update vite.config.ts

Add the following code to the vite.config.ts so your app can resolve paths without error:

Step 6. Run the CLI

Run the shadcn init command to setup your project:

You will be asked a few questions to configure components.json.

Step 7. Add Shadcn Components

You can now start adding components to your project.

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

Step 8. Additional Package Installation

Additional package installation for congrats confetti and motion animation

Import modules

Step 9.

Last updated