The Best Next.js 13.4 UI Library (shadcn/ui Setup and Tutorial)
If you’re developing a web application using Next.js 13.4, you’ll want to make use of a UI library that can help you build beautiful and functional user interfaces. One popular choice for Next.js developers is the shadcn/ui library. In this article, we’ll look at how to set up and use the shadcn/ui library in a Next.js 13.4 project.
Setting Up shadcn/ui in a Next.js 13.4 Project
The first step to using shadcn/ui in a Next.js project is to install the library. You can do this using npm or yarn:
npm install @shadcn/ui
# or
yarn add @shadcn/ui
Once the library is installed, you can start using its components in your Next.js project. First, you’ll need to import the components you want to use from the shadcn/ui library:
import { Button, Input, Card } from '@shadcn/ui';
Now you can use these components in your Next.js project just like you would with any other React components. For example:
function MyComponent() {
return (
);
}
Tutorial: Creating a Simple Next.js 13.4 UI with shadcn/ui
Let’s walk through a simple tutorial where we create a basic UI using shadcn/ui in a Next.js 13.4 project. First, create a new Next.js project if you haven’t already:
npx create-next-app@13.4 my-nextjs-app
Next, navigate into the project directory and install the shadcn/ui library:
cd my-nextjs-app
npm install @shadcn/ui
Now replace the contents of the pages/index.js
file with the following code:
import { Button, Card, Input } from '@shadcn/ui';
export default function Home() {
return (
);
}
Now run your Next.js 13.4 project using npm run dev
and navigate to http://localhost:3000 in your browser. You should see a simple UI with an input field and a button, styled using the shadcn/ui library.
That’s it! You’ve successfully set up and used the shadcn/ui library in a Next.js 13.4 project. From here, you can explore the full range of components and styles offered by the library to create beautiful and functional user interfaces for your web application.
Whenever I see .ts or .tsx I run far away from the library 🥰🥰 It's probably just me.
Looked great. Then I checked shadcn and Radix….quite bad experience. I followed the steps but there are big holes in the startup tutorial and I get errors quite early. I don't get the hype around shadcn. It is not a gamechanger, it is just another tool. Which has bugs. Now I go to other libraries to check how they perform
This process makes me appreciate MUI more.
I really liked your video. you doing good work. keep it up.
Lie berry.
doesn't shadcn specifically say they are not a library???
SurrealDB
I love your videos. Could you please do a small Next.js 13 project video using this Shadcn UI, will be highly appreciated
Wait. If the components use 'use client' they are client rendered…. so this library does not really do SSR… am I wrong?
Awesome lil tutorial! Maybe next go in-depth on customization?
I love the tutorial. Thank you very much for sharing your knowledge with the world. If possible, please, make a tutorial on how to create a full-stack app using ShadCN-UI. I ve been looking for such a tutorial for a long time, but there is none.
Hey is there any other library which can work great with Next 13 app directory
shadcn/ui seems amazing and eazy to use!
What about styling those components is it easy (eg. bg color text color)? Or is it not recommended?
awesome, thanks!
Out of curiosity can this be used on other react frameworks say remix or just NextJS? Is it just examples are made with NextJS or the only works with NextJS?
Thank you
So, nobody is recognizing radix-ui but shadcnui which itself is built on top of radix?
what an awesome tutorial! very clear and you have covered everything from scratch! any newbie can follow this til the end! Thank you so much
Nice. It has a macOS look to it. I like the menu bar. I wish there was a tree view or list component
Great tutorial – this shadcn library looks great ! – thanks.