Exploring the popular UI library: shadcn/ui
Having gained significant traction—ranking No.1 in the 2023 JavaScript Rising Stars—it has quickly become a popular choice among developers. In this article, we experimented with shadcn/ui to build forms and websites.


What is shadcn/ui?
One of the defining features of shadcn/ui is the ability to install only the components you need. This allows developers to create lightweight and flexible component structures tailored to the specific requirements of a project.
In terms of size, it is comparable to widely used libraries such as MUI and Bootstrap (approximately 100KB for MUI, 81KB for Bootstrap, and around 87KB for shadcn/ui), meaning it has minimal impact on overall site performance.
Installation
1. Create a Project
npx create-next-app@latest my-app --typescript --tailwind --eslintUse the above command to create a new project.
2. Run the CLI
npx shadcn-ui@latest initRun this command to set up shadcn/ui. During the process, you will be prompted with a few questions—simply answer them accordingly.
3. Start the local environment
Use npm run dev to launch the local development environment, then open http://localhost:3000 in your browser.
4. Install the Components You Need and Customize Freely
Select the components you want from the official site, install them via copy and paste, and integrate them into your project as needed. For example, to install a button component, visit https://ui.shadcn.com/docs/components/button
npx shadcn-ui@latest add buttonRun the above command to install the button component.
import { Button } from "@/components/ui/button"Add this import to the file where you want to use the component, then
<Button variant="outline">Button</Button>use it to render the button component.
Building a form
As a review and a practical example, here are the steps to implement a form.
1. Install the Required Components
Use npx to install the necessary components.
npx shadcn-ui@latest add form npx shadcn-ui@latest add button npx shadcn-ui@latest add input npx shadcn-ui@latest add toastWith shadcn/ui, only the components you need are loaded, enabling a lightweight and efficient implementation.
2. Create a Form.tsx File
Define the form using a Zod schema.
"use client"
import { z } from "zod"
const formSchema = z.object({
username: z.string().min(2).max(50),
})3. Define the Form
Create the form using the useForm hook from react-hook-form.
"use client"
import { zodResolver } from "@hookform/resolvers/zod"
import { useForm } from "react-hook-form"
import { z } from "zod"
const formSchema = z.object({
username: z.string().min(2, {
message: "Username must be at least 2 characters.",
}),
})
export function ProfileForm() {
// 1. Define the form.
const form = useForm>({
resolver: zodResolver(formSchema),
defaultValues: {
username: "",
},
})
// 2. Define the submit handler.
function onSubmit(values: z.infer) {
console.log(values)
}
} 4. Build the Form
Now that the <Form> component is available, you can use it to construct your form.
"use client"
import { zodResolver } from "@hookform/resolvers/zod"
import { useForm } from "react-hook-form"
import { z } from "zod"
import { Button } from "@/components/ui/button"
import {
Form,
FormControl,
FormDescription,
FormField,
FormItem,
FormLabel,
FormMessage,
} from "@/components/ui/form"
import { Input } from "@/components/ui/input"
const formSchema = z.object({
username: z.string().min(2, {
message: "Username must be at least 2 characters.",
}),
})
export function ProfileForm() {
const form = useForm>({
resolver: zodResolver(formSchema),
defaultValues: {
username: "",
},
})
function onSubmit(values: z.infer) {
console.log(values)
}
return (
)
} 5. Setting the Theme
You can configure the theme from this link.
After selecting your preferred settings, click “Copy code” to copy the generated code, and overwrite the existing styles in src/app/globals.css.
In this example, we selected default, green, 0.5, and light.
6. Final Result
Without requiring any additional styling or explicit accessibility configurations, we were able to create an input form that fully supports keyboard interactions.


Bonus
In addition, we created a sample page by combining various other components, which we would also like to introduce.
https://shadcn-ui-mrh8.vercel.app/
The page also achieves a very high performance score.
Future outlook
In recent years, technological innovation driven by generative AI has been advancing at a remarkable pace.
shadcn/ui is no exception. Vercel has introduced v0.dev, an AI tool specialized in UI generation using shadcn/ui, enabling developers to create high-quality interfaces simply through copy and paste.
In addition, the developer has shared on X plans to integrate AI for generating personalized documentation. This appears to be a pioneering initiative, and it is one of the features I am most looking forward to.
As demonstrated above, this library is under active development and continuous improvement, suggesting strong potential for the future.
Conclusion
shadcn/ui is a highly customizable UI component library built on Radix UI and Tailwind CSS. Its key features include the ability to install only the components you need, ease of implementation, and extensive customization options for both components and themes—enabling flexible and efficient UI development.
Furthermore, integration with AI technologies is rapidly advancing. With the emergence of UI generation tools like v0.dev powered by shadcn/ui, as well as plans for AI-driven personalized documentation, the library shows strong promise for the future.
For development environments that require both rapid iteration and accessibility considerations, shadcn/ui is an excellent fit. As such, I personally look forward to actively incorporating it into future projects.
References
Reference: shadcn/ui - Introduction -
Reference: Using the Popular shadcn/ui with Next.js
Reference: shadcn/ui as the Right Choice for React UI Components
Reference: Fundamentals for Mastering the Rapidly Growing shadcn/ui Library
RECENT POSTS
Vol.203
What Is Design Management
Vol.202
Why Hiring No Longer Works— Redesigning Organizations and Decisions for an Uncertain Age
Vol.201
How to Choose a Branding Agency: 5 Criteria to Avoid Failure
Vol.200
Design Management: A Practical Guide for SMEs and Startups to Drive Real Results
Vol.199
How to Rebuild Brand Competitiveness: A Practical Guide to Brand Management for SMEs
Vol.198
From parent–child bonds to community: The future of education that nurtures diversity and designs relationships








