Monorepo integration

Set up Untitled UI React in a monorepo with Next.js or Vite. Learn how to share components across multiple apps and configure workspaces for optimal development.

Installation

The easiest way to get started with Untitled UI in a monorepo is to use our CLI to initialize in an existing project:

1

Navigate to your target directory

First, navigate to the directory where you want to set up Untitled UI. This could be your app directory or a shared components package:

cd apps/web
# or
cd packages/ui
# or wherever you want to initialize
2

Initialize with CLI

Use the CLI to initialize Untitled UI in your existing monorepo web or ui package:

npx untitledui@latest init
3

Ready to go!

Great! You're all set to start using Untitled UI components in your monorepo.

If something is missing, you can copy/paste what you need into your project directly from individual components pages.

Need help? Check our GitHub repository for examples, or open an issue if you run into any problems. Our community is here to help!

Custom configurations

When working in a monorepo, you'll often need custom import paths. The CLI reads your components.json file to understand and use your custom alias paths:

1

Configure components.json

Create or update a components.json file in your components directory. The CLI will read this file to understand your custom alias paths:

{
  "aliases": {
    "components": "@workspace/ui/components",
    "utils": "@workspace/ui/utils",
    "styles": "@workspace/ui/styles",
    "hooks": "@workspace/ui/hooks"
  },
  "examples": "../../apps/web"
}
  • @workspace/ui for shared UI packages
  • @/components for app-relative imports

Working with example pages: Add "examples" key to specify where your web project is located in the monorepo. This allows the CLI to correctly resolve paths when adding example files to your project.

2

Configure tailwind paths

Update your styles/globals.css to include component paths using @source:

@import "tailwindcss";
...
/* Adjust paths based on your monorepo structure */
@source "../**/*.{ts,tsx}";
3

Add components with the CLI

Now you can add components using the CLI from your components directory:

npx untitledui@latest add button

The CLI will:

  • Read your components.json configuration
  • Use your custom alias paths in the generated components
  • Install components in the correct directory structure
  • Update imports to match your monorepo setup

Need help? Check our GitHub repository for examples, or open an issue if you run into any problems. Our community is here to help!