Create project
Start by creating a new Next.js project using create-next-app
:
Run the CLI
Run the @uplusion23/forge-ui
init command to setup your project:
You will be asked a few questions to configure components.json
:
Fonts
I use Inter as the default font. Inter is not required. You can replace it with any other font.
Here's how I configure Inter for Next.js:
1. Import the font in the root layout:
2. Configure theme.extend.fontFamily
in tailwind.config.js
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.
The command above will add the Button
component to your project. You can then import it like this: