Installation
A simple guide to set up UP Kit with the required dependencies and structure
This project is built with Next.js, using TypeScript and Tailwind CSS for all components.
Create a Next.js project
Start by creating a new Next.js project if you don't have one set up already.
pnpm create next-app@latest my-app --typescript --tailwind --app
cd my-appnpx create-next-app@latest my-app --typescript --tailwind --app
cd my-appbunx create-next-app@latest my-app --typescript --tailwind --app
cd my-appyarn create next-app@latest my-app --typescript --tailwind --app
cd my-appInstall shadcn/ui
UP Kit is built on top of shadcn/ui. Set it up in your project:
pnpm dlx shadcn@latest initnpx shadcn@latest initbunx shadcn@latest inityarn dlx shadcn@latest initFollow the prompts to configure your components.json. We recommend:
- Style: Default
- Base color: Slate
- CSS variables: Yes
Install utilities
If the libs/utils.ts file is not present in your project, you can install it using the following command:
pnpm dlx shadcn@latest add https://kit.uxpatterns.dev/r/utils.jsonnpx shadcn@latest add https://kit.uxpatterns.dev/r/utils.jsonbunx shadcn@latest add https://kit.uxpatterns.dev/r/utils.jsonyarn dlx shadcn@latest add https://kit.uxpatterns.dev/r/utils.jsonConfigure namespaced registries (Recommended)
For a cleaner installation experience, you can configure namespaced registries in your components.json file. This allows you to use @namespace/component syntax instead of full URLs.
Add the registries object to your existing components.json:
{
...
"registries": {
"@upkit": "https://kit.uxpatterns.dev/r/{name}.json"
}
}What are namespaced registries? This feature allows you to organize components from different sources using clean namespace prefixes like @upkit/button instead of long URLs. It's supported in shadcn CLI 3.0+ and provides better organization and easier discovery of components.
Add your first component
Now you can start adding UP Kit components to your project using either method:
pnpm shadcn@latest add @upkit/buttonnpx shadcn@latest add @upkit/buttonbunx shadcn@latest add @upkit/buttonyarn shadcn@latest add @upkit/buttonpnpm dlx shadcn@latest add https://kit.uxpatterns.dev/r/button.jsonnpx shadcn@latest add https://kit.uxpatterns.dev/r/button.jsonbunx shadcn@latest add https://kit.uxpatterns.dev/r/button.jsonyarn dlx shadcn@latest add https://kit.uxpatterns.dev/r/button.jsonThen import and use the components in your project:
import { Button } from "@component/upkit/button"
export default function HomePage() {
return (
<div>
<Button>Click me</Button>
</div>
)
}Understanding namespaced registries
The namespaced registry system in shadcn CLI 3.0+ provides several benefits:
Benefits:
- Cleaner syntax: Use
@upkit/buttoninstead of long URLs - Better organization: Clear separation between different component libraries
- Easier discovery: More intuitive component names
- Multiple registries: Support for multiple component sources in one project
Example with multiple registries:
{
"registries": {
"@upkit": "https://kit.uxpatterns.dev/r/{name}.json",
"@kibo-ui": "https://www.kibo-ui.com/r/{name}.json",
"@tailark": "https://tailark.com/r/{name}.json"
}
}Usage:
# Install from UP Kit
npx shadcn@latest add @upkit/button
# Install from other registries
npx shadcn@latest add @kibo-ui/gantt
npx shadcn@latest add @tailark/heroBackward compatibility: The old URL-based method still works for users who prefer it or need to install from unregistered sources:
npx shadcn@latest add https://kit.uxpatterns.dev/r/button.jsonDone! 🎉
You can now use the UP Kit CLI to add components, or manually copy-paste them from the documentation.