Step by step instruction to set up your project
Setting up a Next.js project with Chakra UI involves several steps, including installing the necessary dependencies, configuring your project, and adding basic components.
If you followed the instructions from the Learn Javascript section, you can skip to the Change Project Directory Section.
Follow these step-by-step instructions to get started:
Ensure that you have Node.js (version 12 or higher) and npm (version 6 or higher) installed on your system. You can check the installed versions by running the following commands in your terminal or command prompt:
Run the following command to create a new Next.js application using the default starter template:
Replace your-app-name with your desired application name.
Navigate to the newly created project directory by running:
You can check which project directory you are in by looking at your terminal in VS Code or other IDE.
In the project directory, run the following command to install Chakra UI and its peer dependencies:
If you want to use Chakra UI's icon library, run the following command to install:
In the "pages" directory of your project, create or edit the _app.js file to include the ChakraProvider. Replace the existing content with the following code:
Now, you can start using Chakra UI components in your Next.js project. As an example, open the "pages/index.js" file and replace its content with the following code:
In the terminal or command prompt, run the following command to start the development server:
Open your browser and navigate to http://localhost:3000 to see your Next.js project with Chakra UI up and running.