React
How to integrate Webcore into React
Source ↗️ Report Issue ↗️This documentation helps you guide through the steps to integrate Webcore into your React project. The easiest way to get started is to use the CLI. Run the following command in your terminal and follow the prompts to install React with Webcore:
If you’d like to integrate Webcore into an existing project, you can follow the steps below to configure it manually.
-
Create a new React Project
If you don’t have an existing project, start by creating a new React project by running the following command in your terminal:
-
Add Webcore
Add Webcore as a dependency by running the following command in your terminal:
-
Update Vite Configuration
Update your Vite (
vite.config.ts
file at the root of your project) configuration file with the following lines: -
Create the CSS Configuration File
Add an empty
webcore.config.scss
file at the root of your project. You can read more about how you can configure your CSS using this file in the CSS Configuration section. -
Configure CSS
Create a
styles.scss
file in yoursrc
folder, then add the following lines to setup default styles and fonts by calling thesetup
mixin:Make sure the path to your fonts are correctly configured. The above example assumes your fonts are present in the
public/fonts
directory.You can download the fonts Webcore uses from thepublic/fonts
directory.Import this file into your
main.tsx
file to add the necessary CSS to your app: -
Using Components
That’s it! You’re all set to start using Webcore components in your React project. Import components from
webcoreui/react
:Then run your dev server using the following command to view your app:
Source Code
Request improvement for this page