How to install dependencies and structure your app.
If you have configured shadcn/ui using the shadcn cli, jump to step
4. You can skip the installation steps below.
There are two ways to install this application.
Use shadcn cli to install required files (easiest way)
Manually set up config files
After using these methods, if you intend to use components with links please see the Router Provider instructions at the bottom.
Method 1: Using shadcn cli
Create project
Make sure to use the registry for jolly-ui. You do this by ensuring you have
the REGISTRY_URL=https://jollyui.dev/r environment variable set where you
are running the command.
Run the init command to create a new Next.js project or to setup an existing one:
Configure components.json
You will be asked a few questions to configure components.json:
App structure
Here's how I structure my Next.js apps. You can use this as a reference:
I place the UI components in the components/ui folder.
The rest of the components such as <PageHeader /> and <MainNav /> are placed in the components folder.
The lib folder contains all the utility functions. I have a utils.ts where I define the cn helper.
The styles folder contains the global CSS.
That's it
You can now start adding components to your project. This can be done two ways using the CLI.
Using the REGISTRY_URL environment variable. (Recommended)
Using the components URL. (Note you will need to specify the style, e.g https://jollyui.dev/new-york/button)
The command above will add the Button component to your project. You can then import it like this:
Method 2: Manual setup
These instructions should be the same as the
shadcn/ui manual
installation instructions.
Add Tailwind CSS
Components are styled using Tailwind CSS. You need to install Tailwind CSS in your project.