Setting up and Tutorial for the Best Next.js 13.4 UI Library: shadcn/ui

Posted by

The Best Next.js 13.4 UI Library (shadcn/ui Setup and Tutorial)

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.

0 0 votes
Article Rating
24 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
@RubenKannan
7 months ago

Whenever I see .ts or .tsx I run far away from the library 🥰🥰 It's probably just me.

@karamcsand
7 months ago

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

@meilyn22
7 months ago

This process makes me appreciate MUI more.

@thecodeconfesses256
7 months ago

I really liked your video. you doing good work. keep it up.

@DavidWTube
7 months ago

Lie berry.

@aaron6822
7 months ago

doesn't shadcn specifically say they are not a library???

@StephenRayner
7 months ago

SurrealDB

@chuksvalentine3735
7 months ago

I love your videos. Could you please do a small Next.js 13 project video using this Shadcn UI, will be highly appreciated

@itamarsharify
7 months ago

Wait. If the components use 'use client' they are client rendered…. so this library does not really do SSR… am I wrong?

@leoprimo123
7 months ago

Awesome lil tutorial! Maybe next go in-depth on customization?

@kamaliddinsattorov7493
7 months ago

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.

@Shubham-yc6nz
7 months ago

Hey is there any other library which can work great with Next 13 app directory

@omarkraidie
7 months ago

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?

@Legendman234
7 months ago

awesome, thanks!

@aplusphilic
7 months ago

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?

@vanshshah7781
7 months ago

Thank you

@musaddikrayat
7 months ago

So, nobody is recognizing radix-ui but shadcnui which itself is built on top of radix?

@geraldsy
7 months ago

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

@elmcapp6032
7 months ago

Nice. It has a macOS look to it. I like the menu bar. I wish there was a tree view or list component

@paulthomas1052
7 months ago

Great tutorial – this shadcn library looks great ! – thanks.