shadcn/ui Command Line (CLI) Tool

Learn about the shadcn/ui CLI tool and how to use it to automate tasks.

Project Source Code

Get the project source code below, and follow along with the lesson material.

Download Project Source Code

To set up the project on your local machine, please follow the directions provided in the README.md file. If you run into any issues with running the project source code, then feel free to reach out to the author in the course's Discord channel.

Previous LessonExploring the shadcn/ui next-template Project StructureNext LessonSummary

This lesson preview is part of the Sleek Next.JS Applications with shadcn/ui course and can be unlocked immediately with a \newline Pro subscription or a single-time purchase. Already have access to this course? Log in here.

This video is available to students only
Unlock This Course

Get unlimited access to Sleek Next.JS Applications with shadcn/ui, plus 70+ \newline books, guides and courses with the \newline Pro subscription.

Thumbnail for the \newline course Sleek Next.JS Applications with shadcn/ui

In this lesson, you will learn about the Chatsie Commanding Tool. Chatsie and UI as a built-in command-lay tool, CLI, to automate some tasks. The available commands are init, add-in it initializes Chatsie and UI in an existing project. The add component installs Chatsie and UI component to a project, and the diff command checks for updates against the component registry. The easiest way to run the CLI is with NPX. If you have npm installed, you should download the event peaks, so call NPX inside the 'Newsed' folder, call NPX, Chatsie and UI at latest, add navigation menu, it's a component from Chatsie and UI that we are going to use in this project. Great! The add command is responsible for installing a component from the registry to the project. You can also go ahead and copy-paste the components manually from the docs if you'd like, but it takes a bit more time than running the command. The command is also responsible for installing any dependencies and the components themselves. You can use it the way we've seen. After the command finishes, you should see a new file under the UI folder. Let's add the card component. NPX, Chatsie and UI at latest, add card, now you should see Dan being printed in the console. Go back to the UI folder, click on the card, and here is the card source code. Now to validate the installation finish successfully, let's go to app/page.t6 and change everything inside into a card, remove everything that you see, import the card component, and render it with the class name of 'B4' change the class name here to 'amixauto', 'empty8' and 'max with excel' and add an 'h1' with class name, text-large and 'hello' world. This is the Chatsie and UI 'hello' world. You can remove the imports. And then let's validate it, run npm run dev in your favorite terminal, and then open 'cut' and then open the local URL in your browser. If everything was successful, you should see this page and a 'hello' world card rendered inside the browser. The div command allows viewing a list of the current project installed component that have been updated in the registry. Let's run the following command, 'npeix' / Chatsie and UI at latest, 'dif'. The output should look something like the following. The following components have updates available, and then a list of them. Right now we see the button one. We call the 'dif' command with the component to see the actual changes. Here we can now see the difference between the registry run and the one that we have installed. We can update it if we want with the 'ed' command. The 'init' command is responsible for initializing Chatsie and UI inside an existing project. You can run it with the 'npeix' / Chatsie and UI at latest in it. We created a new 'next' application in my terminal. Then I'm running the Chatsie and UI at latest in its command. Running the command will present a list of questions. The CLI will add Chatsie and UI to the project based on the responses. Which style would you like to use? Which color would you like to use? CSS variables? Then it will install the required dependencies like 'radix UI', 'next themes' and 'tailwindcss'. It will create the configuration files for tailwindcss and Chatsie and UI. You can see them here. It will add a 'cnu' till inside 'lib/utils' like we have in the template and the required CSS variables in the global.css file. The 'init' command creates a 'combonents.json' file. And it is the 'de facto' Chatsie and UI configuration file. Under the 'wood', Chatsie and UI uses the file to determine the project setup based on the 'init' command answers. As Chatsie and UI uses, it can be used to configure and tweak the library behavior. It probably won't need to be changed very often, but just in case, it also has some properties that you can control using the 'combonent.json' file. The style property, which is the component styles, either default or New York. We are going to learn more about it in the first module. The tailwind, which is the configuration related to tailwind, the config, the CSS file, the base color and more. The TS6, which is whether to use the TypeScript component and RSC, whether React, Server components are supported. There are also aliases defined. In this lesson, you've learned about the Shot CNI command line tool.