Installation
Choose Native Beta or Shadcn Stable once during initialization. The CLI remembers that choice and automatically reuses it for every add command.
Introduction
Binhlaig UI is a collection of reusable React components designed for Next.js and Tailwind CSS projects.
Components are copied into your project
Requirements
Make sure your development environment meets these requirements before installing Binhlaig UI.
Node.js
Node.js 20 or newer is required by the CLI.
Next.js
A Next.js App Router project with TypeScript is recommended.
Tailwind CSS
Tailwind CSS v4; Native init adds the required theme styles automatically.
node --version
npm --versionCreate a Next.js Project
Create a new Next.js project or continue with an existing project.
Create the project
Run the following command and select TypeScript, Tailwind CSS, App Router and the @/* import alias.
npx create-next-app@latest my-app
cd my-appExisting Next.js project
Initialize Binhlaig UI
Choose an installer once. Binhlaig UI saves it in binhlaig.json for future add commands.
Run the init command
Run this command from the root of your Next.js project. The CLI first asks which installer you want to use.
npx binhlaig-ui@latest initBinhlaig Native Beta
Creates binhlaig.json, utility files, the UI directory, theme CSS, and required shared dependencies. The selected installer is saved automatically.
npx binhlaig-ui@latest init --installer nativeShadcn CLI Stable
Uses the Shadcn initialization flow and saves "installer": "shadcn" in binhlaig.json for later add commands.
npx binhlaig-ui@latest init --installer shadcn{
"$schema": "https://ui.binhlaig.com/schema.json",
"installer": "native"
}{
"$schema": "https://ui.binhlaig.com/schema.json",
"installer": "shadcn",
"base": "base"
}Optional: initialize non-interactively
Automation and CI workflows can explicitly select Native and skip confirmation prompts.
npx binhlaig-ui@latest init --installer native --yesInitialization completed
Add Components
Install only the Binhlaig UI components required by your project.
Install your first component
Add the Button component. The CLI reads the installer saved during initialization, so no installer option is required.
npx binhlaig-ui@latest add buttonInstaller selection is remembered
--installeronly for a one-command override.Install more components
You can install multiple components with one command. The saved installer is applied to every component.
npx binhlaig-ui@latest add button card input badge tabs alert avatar breadcrumbImport Components
Import installed components from the components/ui directory.
Button example
After installation, import and use the Button component.
import { Button } from "@/components/ui/button";
export default function Page() {
return (
<main className="p-10">
<Button>
Get Started
</Button>
</main>
);
}Card example
Components can be combined to build complete interface sections.
import { Button } from "@/components/ui/button";
import {
Card,
CardContent,
CardDescription,
CardFooter,
CardHeader,
CardTitle,
} from "@/components/ui/card";
export default function Page() {
return (
<main className="flex min-h-screen items-center justify-center p-6">
<Card className="w-full max-w-md">
<CardHeader>
<CardTitle>Binhlaig UI</CardTitle>
<CardDescription>
Reusable components for React and Next.js.
</CardDescription>
</CardHeader>
<CardContent>
Build modern interfaces quickly.
</CardContent>
<CardFooter>
<Button className="w-full">
Get Started
</Button>
</CardFooter>
</Card>
</main>
);
}Test the application
Start the development server and open your app.
npm run devDark Mode
Binhlaig UI components include dark mode styles using Tailwind CSS dark classes.
Install next-themes
Use next-themes to switch between light, dark and system themes.
npm install next-themesCreate the Theme Provider
"use client";
import * as React from "react";
import { ThemeProvider as NextThemesProvider } from "next-themes";
type ThemeProviderProps = React.ComponentProps<
typeof NextThemesProvider
>;
export function ThemeProvider({
children,
...props
}: ThemeProviderProps) {
return (
<NextThemesProvider {...props}>
{children}
</NextThemesProvider>
);
}Add the provider to the root layout
import type { Metadata } from "next";
import "./globals.css";
import { ThemeProvider } from "@/components/theme-provider";
export const metadata: Metadata = {
title: "Binhlaig UI App",
description: "Built with Binhlaig UI",
};
export default function RootLayout({
children,
}: Readonly<{
children: React.ReactNode;
}>) {
return (
<html lang="en" suppressHydrationWarning>
<body>
<ThemeProvider
attribute="class"
defaultTheme="system"
enableSystem
disableTransitionOnChange
>
{children}
</ThemeProvider>
</body>
</html>
);
}Project Structure
Installed components and configuration files are stored directly inside your project.
components/ui
Installed component source files.
lib/utils.ts
Utility functions such as cn().
binhlaig.json
Saved installer selection, component paths, aliases, and project configuration.
my-app/
├── app/
│ ├── globals.css
│ ├── layout.tsx
│ └── page.tsx
├── components/
│ ├── theme-provider.tsx
│ └── ui/
│ ├── button.tsx
│ ├── card.tsx
│ └── input.tsx
├── lib/
│ └── utils.ts
├── binhlaig.json
├── package.json
└── tsconfig.jsonUpdate or Overwrite a Component
Reinstall a component when a newer registry version is available.
Your existing file will be replaced
npx binhlaig-ui@latest add button --overwriteAvailable Components
Use the list command to display components currently available in the Binhlaig UI registry.
npx binhlaig-ui@latest listTroubleshooting
Common issues that can occur while installing Binhlaig UI.
Command not found
Make sure Node.js and npm are installed. Use the complete npx command instead of calling the package directly.
npx binhlaig-ui@latest initbinhlaig.json is missing
Run the init command in the project root before installing a component.
npx binhlaig-ui@latest initDependencies are not working
Remove node_modules and the package lock file, then reinstall dependencies.
Remove-Item -Recurse -Force node_modules
Remove-Item -Force package-lock.json
npm install
npm run devrm -rf node_modules package-lock.json
npm install
npm run devUnknown component error
Check that the component exists in the current Binhlaig UI registry.
npx binhlaig-ui@latest list