💡 Looking for an API testing tool that creates beautiful API Documentation? Need a unified platform to boost your developer team’s productivity? Apidog brings all these benefits—replacing Postman at a much more affordable price!
Modern frontend teams face intense pressure to deliver fast, beautiful, and highly customized user interfaces. While established UI libraries like Material-UI or Ant Design offer convenience, their rigidity can slow growth and stifle brand uniqueness. Enter HeroUI—a new approach to UI development that prioritizes developer ownership, transparency, and deep customization from the ground up.
This guide will walk API-focused teams, frontend engineers, and product-minded developers through what makes HeroUI unique, how to integrate it with your workflow, and how it compares to traditional UI libraries. Along the way, we’ll share hands-on setup steps, customization tips, and advanced usage patterns—so you can decide if HeroUI’s “source code as components” model is right for your next project.
Why HeroUI? Solving the Pain Points of Traditional UI Libraries
Common Problems with Conventional UI Libraries
Most UI kits install as dependencies in your package.json, locking you into pre-compiled, opaque components. This brings several issues for scaling frontend teams:
- Limited Customization: Overriding library defaults often requires brittle CSS hacks or convoluted theme configs.
- Black Box Debugging: Component logic is hidden inside
node_modules, making bug hunting and learning difficult. - Bundle Bloat: Even if you only use a few components, most libraries add unnecessary weight to your app.
- Dependency Risks: You’re forced to track the library’s update cycle and navigate breaking changes.
For API developers and teams building unique, branded applications, these limitations can slow releases and increase maintenance costs.
HeroUI’s Approach: Total Source Code Ownership
HeroUI flips the script. Instead of importing pre-built components, you use the HeroUI CLI to copy the actual component source code directly into your repo (/components/ui). Every component—button, card, dialog, and more—becomes fully yours to inspect, modify, and extend.
What does this mean for your team?
- Full Control: Refactor, restyle, or extend components as your product grows.
- Transparency: Debug and learn from readable, accessible code.
- Lean Bundles: Only the components you need are included—no unused code.
- Future-Proof: Components live in your codebase, insulated from upstream breaking changes.
HeroUI is ideal for developers who want to own their UI system without reinventing the wheel.
Key Features of HeroUI (and Why They Matter)
- Rich, Modern Component Set: Includes the essentials—buttons, forms, dialogs, tables, and more—engineered with accessibility (ARIA) and usability in mind.
- Tailwind CSS Integration: Styling is utility-first and easily themed via Tailwind, eliminating the need for complex style overrides.
- Centralized Theming via CSS Variables: Update colors, fonts, and radii globally with a few lines in your theme file.
- CLI-Driven Workflow: The
heroui-clihandles project setup, component addition, and config updates—saving hours of manual work. - Framework-First Support: Built for React, with deep compatibility for Next.js, Vite, and other modern frameworks.
- Dark Mode by Default: Theme switching is built-in, powered by CSS variables and Tailwind variants for minimal effort.
- TypeScript and RSC Ready: Out-of-the-box support for type safety and Next.js React Server Components.
Who should use HeroUI?
- Developers frustrated by traditional library rigidity
- Teams building custom-branded or design-driven products
- Startups balancing speed and scalability
- Engineers looking to learn modern, accessible component patterns
Step-by-Step: How to Install and Set Up HeroUI
Ready to try HeroUI? Here’s how to get started in a professional project environment (Next.js + TypeScript + Tailwind CSS recommended).
Prerequisites
- Node.js (v18+)
- npm/yarn/pnpm (npx is used in this guide)
- A React project (Next.js recommended)
If you need a new project, create one with:
npx create-next-app@latest my-heroui-app
Choose TypeScript and Tailwind CSS during setup for best results.
1. Initialize HeroUI with the CLI
Navigate to your project and run:
cd my-heroui-app
npx heroui-cli@latest init
The CLI will ask a series of configuration questions:
- Base Style: Choose “Default” (modern) or “New York” (classic) for your starting look.
- Base Color: Select a neutral palette (slate, gray, zinc, neutral, stone) for your theme.
- Global CSS Path: Where your main CSS file lives (defaults detected).
- Use CSS Variables for Colors: Almost always “Yes” for dynamic theming.
- Tailwind Config Path: Confirm or specify your Tailwind config location.
- Import Aliases: Set up clean imports for components (
@/components) and utils (@/lib/utils). - React Server Components: The CLI auto-detects if your project uses RSC and configures accordingly.
What the CLI Does
- Installs dependencies (
tailwindcss-animate,class-variance-authority,lucide-react, etc.) - Creates
components.jsonmanifest for HeroUI - Updates
tailwind.config.jswith theme settings and plugin - Injects CSS variables and base styles into
globals.css - Adds path aliases to your
tsconfig.json - Sets up utility functions in
lib/utils.ts
Customizing HeroUI: Theming, Layouts, and Dark Mode
Theme Your App With CSS Variables
HeroUI’s design system is powered by CSS variables in your globals.css.
Change your brand color:
Edit the --primary and --primary-foreground variables:
:root {
--primary: 142.1 76.2% 36.3%; /* Vibrant green */
--primary-foreground: 355.7 100% 97.3%; /* Contrasting text */
}
.dark {
--primary: 142.1 70.2% 46.3%;
--primary-foreground: 355.7 100% 97.3%;
}
Adjust border radius globally:
:root {
--radius: 0.75rem; /* Softer corners */
}
Add a custom color:
- Add variables in
globals.css::root { --special: 320 86% 59%; --special-foreground: 330 100% 98%; } .dark { --special: 320 80% 69%; --special-foreground: 330 100% 98%; } - Extend Tailwind in
tailwind.config.js:extend: { colors: { special: { DEFAULT: "hsl(var(--special))", foreground: "hsl(var(--special-foreground))" }, }, },
Build Responsive Layouts
HeroUI provides the building blocks—using Tailwind’s utilities, you compose responsive layouts. For example, a dashboard with a sidebar:
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
import { Button } from "@/components/ui/button";
export default function DashboardPage() {
return (
<div className="flex min-h-screen flex-col md:flex-row">
<aside className="w-full border-b bg-muted p-4 md:w-64 md:border-b-0 md:border-r">
<h2 className="text-lg font-semibold">Navigation</h2>
<nav className="mt-4 flex flex-row space-x-2 md:flex-col md:space-x-0 md:space-y-2">
<Button variant="ghost" className="justify-start">Dashboard</Button>
<Button variant="ghost" className="justify-start">Settings</Button>
<Button variant="ghost" className="justify-start">Profile</Button>
</nav>
</aside>
<main className="flex-1 p-8">
<h1 className="text-4xl font-bold tracking-tight">Dashboard</h1>
<p className="mt-2 text-muted-foreground">Welcome to your dashboard.</p>
<div className="mt-8 grid gap-4 sm:grid-cols-2 lg:grid-cols-3">
<Card>
<CardHeader><CardTitle>Revenue</CardTitle></CardHeader>
<CardContent><p className="text-3xl font-bold">$45,231.89</p></CardContent>
</Card>
{/* ...more cards */}
</div>
</main>
</div>
);
}
Effortless Dark Mode
HeroUI’s theming makes dark mode simple. Use the next-themes package:
npm install next-themes
Add a Theme Provider:
// components/theme-provider.tsx
"use client";
import { ThemeProvider as NextThemesProvider } from "next-themes";
export function ThemeProvider({ children, ...props }) {
return <NextThemesProvider {...props}>{children}</NextThemesProvider>;
}
Wrap your root layout:
import { ThemeProvider } from "@/components/theme-provider";
// ...
<ThemeProvider attribute="class" defaultTheme="system" enableSystem>
{children}
</ThemeProvider>
Add a toggle button:
"use client";
import { Moon, Sun } from "lucide-react";
import { useTheme } from "next-themes";
import { Button } from "@/components/ui/button";
export function ModeToggle() {
const { setTheme, theme } = useTheme();
return (
<Button variant="outline" size="icon" onClick={() => setTheme(theme === "light" ? "dark" : "light")}>
<Sun className="..."/>
<Moon className="..."/>
<span className="sr-only">Toggle theme</span>
</Button>
);
}
HeroUI CLI: Managing and Growing Your Component Library
HeroUI’s CLI makes adding new components frictionless. Example: add a dialog modal with
npx heroui-cli@latest add dialog
The CLI:
- Reads your
components.jsonconfig - Fetches and copies the dialog component (and any dependencies) into your project
- Updates imports and alerts you to required packages
You can add multiple components at once:
npx heroui-cli@latest add card button input label
This workflow means you never include unnecessary code—only the parts your app actually uses.
HeroUI vs. Traditional UI Libraries: A Quick Comparison
| Feature | HeroUI | Material-UI / Ant Design |
|---|---|---|
| Component Access | Source code in your repo | Opaque, imported from package |
| Customization | Unlimited (edit source directly) | Via props, theming overrides |
| Bundle Size | Only used components | Often large, hard to tree-shake |
| Debuggability | Full visibility, easy learning | Black box, harder to debug |
| Theming | CSS variables, Tailwind | JS theme objects, overrides |
| Framework Focus | React, Next.js, Vite | React (sometimes Angular) |
| Dark Mode | Built-in, via CSS variables | Theme provider, more config |
Apidog Tip: API Documentation and UI Go Hand-in-Hand
When you’re building powerful, modern web apps with teams, you need both a flexible UI and robust API workflows. Apidog enables seamless API documentation, team collaboration for maximum productivity, and can replace Postman at a fraction of the price—making it a smart companion for frontend and backend teams working side by side.
Conclusion: Is HeroUI Right for Your Team?
HeroUI is designed for technical teams who need flexibility, control, and scalability in their UI systems—without sacrificing speed or developer experience. Its CLI-driven, source-code-first approach empowers you to own, customize, and scale your UI as your product evolves.
Choose HeroUI if you:
- Want total control and transparency over your components
- Need a modern, Tailwind-powered design system that adapts to your brand
- Prefer a lean, dependency-light codebase
- Value learning and maintainability
Pair it with Apidog for a complete, productive developer workflow—from API development to UI delivery.



