A modern, accessible React component library and development toolkit.
# Install components via CLI (recommended)
npx @component-labs/cli init
npx @component-labs/cli add button input dialog
# Or install as npm package
npm install @component-labs/uiThis monorepo contains multiple packages:
- @component-labs/ui - React UI component library with Tailwind CSS v4 and Ariakit
- 8 accessible components
- Dark mode support
- Fully themeable with CSS variables
- Tree-shakeable exports
-
@component-labs/cli - CLI for installing components (shadcn/ui style)
- Copy components directly to your project
- Automatic CSS setup
- TypeScript path alias configuration
-
@component-labs/registry - Component metadata registry
- Component source storage
- Dependency tracking
- Used by CLI for installations
-
@component-labs/react-showcase - Component showcase tool for React
- Live component preview
- Vite-based
- CLI included
-
@component-labs/nextjs-showcase - Component showcase tool for Next.js
- SSR support
- Next.js App Router compatible
- CLI included
component-labs/
βββ apps/
β βββ component-labs/ # Main website
β βββ react-showcase/ # React showcase tool (v0.5.1)
β βββ nextjs-showcase/ # Next.js showcase tool (v0.1.1)
β
βββ packages/
βββ ui/ # Component library (v0.0.2)
βββ cli/ # CLI installer (v0.0.2)
βββ registry/ # Component registry (v0.0.2)
Built on Ariakit for WCAG 2.1 Level AA compliance out of the box.
Modern utility-first styling with the latest Tailwind CSS features:
- CSS
@importsyntax - CSS custom properties
@themedirective- Dark mode support
- Components copied to your project
- Full source code control
- Modify components as needed
- Import:
@/components/ui/button
- Install as a package
- Easy updates via npm
- Tree-shakeable
- Import:
@component-labs/ui/button
Easy customization with CSS variables:
@theme {
--color-primary-600: oklch(50% 0.2 250);
--radius-md: 0.5rem;
}See the Usage section below for installation and usage instructions.
- Node.js >= 18
- pnpm >= 8
# Clone the repository
git clone https://github.com/BenDavies1218/component-labs.git
cd component-labs
# Install dependencies
pnpm install
# Build all packages
pnpm build
# Start development
pnpm devpnpm build- Build all packagespnpm --filter @component-labs/ui build- Build UI package onlypnpm --filter @component-labs/cli build- Build CLI only
pnpm dev- Start the main websitepnpm showcase- Start React Showcase dev serverpnpm nextjs-showcase- Start Next.js Showcase dev server
pnpm test- Run all testspnpm test:watch- Watch mode
- See PUBLISHING.md for detailed publishing instructions
- Or run
./scripts/publish-all.shto publish all packages
-
Create component file:
packages/ui/src/components/your-component/YourComponent.tsx
-
Add showcase file:
packages/ui/src/components/your-component/YourComponent.showcase.tsx
-
Add docs file:
packages/ui/src/components/your-component/YourComponent.docs.tsx
-
Export from UI package:
// packages/ui/src/your-component.ts export { YourComponent } from "./components/your-component/YourComponent";
-
Add to registry:
# Add component metadata to packages/registry/src/registry/ packages/registry/src/registry/your-component.ts -
Update registry index:
// packages/registry/src/index.ts import { yourComponent } from "./registry/your-component"; export const registry: Registry = { // ... existing components "your-component": yourComponent, };
-
Update vite config:
// packages/ui/vite.config.ts entry: { // ... existing entries "your-component": resolve(__dirname, "src/your-component.ts"), }
Component Labs provides two ways to use components in your project:
The CLI installs component source code directly into your project, allowing full customization:
# Initialize Component Labs in your project
npx @component-labs/cli init
# Add components to your project
npx @component-labs/cli add button input dialog
# Or add all components
npx @component-labs/cli addThis will:
- Create a
components.jsonconfiguration file - Set up CSS imports in your global stylesheet
- Copy component source files to your project
- Install required dependencies
Your global CSS file should contain:
@import "tailwindcss";
@import "@component-labs/ui/base";
/* Your custom styles here */Usage:
import { Button } from "@/components/ui/button";
function App() {
return (
<Button variant="default" size="md">
Click me
</Button>
);
}Install components as a traditional npm package:
pnpm add @component-labs/uiSetup your global CSS:
@import "tailwindcss";
@import "@component-labs/ui/base";Usage:
import { Button } from "@component-labs/ui/button";
import { Input } from "@component-labs/ui/input";
import { Dialog } from "@component-labs/ui/dialog";
function App() {
return (
<div>
<Button variant="default" size="md">Click me</Button>
<Input label="Email" type="email" />
</div>
);
}Component Labs uses CSS custom properties for theming. Override them in your global CSS:
@import "tailwindcss";
@import "@component-labs/ui/base";
@theme {
/* Override primary colors */
--color-primary-600: oklch(50% 0.2 250);
--color-primary-700: oklch(45% 0.2 250);
/* Override border radius */
--radius-md: 0.5rem;
}button- Interactive buttons with multiple variantscheckbox- Accessible checkbox inputsinput- Text inputs with labels and iconsdialog- Modal dialogsswitch- Toggle switchesmenu- Dropdown menuscombobox- Searchable select inputsdata-table- Data tables with sorting and infinite scroll
Component Labs includes two showcase tools for documenting and testing your components:
A lightweight component showcase tool for Vite-based React projects.
# Install
npm install @component-labs/react-showcase
# Use CLI
npx component-showcase devFeatures:
- Live component preview
- Hot module replacement
- Automatic component discovery
- Customizable showcase configurations
A showcase tool built for Next.js with SSR support.
# Install
npm install @component-labs/nextjs-showcase
# Use CLI
npx nextjs-showcase devFeatures:
- Server-side rendering support
- Next.js App Router compatible
- Automatic route generation
- SEO-friendly component documentation
- React 19 - UI framework
- TypeScript - Type safety
- Tailwind CSS v4 - Modern utility-first CSS
- Ariakit - Accessible component primitives
- Vite - Build tool and dev server
- Next.js 16 - React framework (for Next.js Showcase)
- Vitest - Testing framework
- pnpm - Monorepo package manager
- UI Components README - Detailed component documentation
- CLI README - CLI usage and configuration
- Publishing Guide - Package publishing instructions
- Implementation Summary - Technical implementation details
We welcome contributions! Please see our contributing guidelines:
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
- UI Library, CLI, Registry: MIT License
- Showcase Tools: AGPL-3.0 License
See individual package directories for detailed license information.
- shadcn/ui - Inspiration for the CLI installation pattern
- Ariakit - Accessible component primitives
- Tailwind CSS - Utility-first CSS framework
- Issues: GitHub Issues
- Discussions: GitHub Discussions
Built with β€οΈ by Benjamin Davies