Getting Started
16 May 20254 minutes to read
This section explains the steps required to create the ProgressBar control using React and configure its properties.
Dependencies
Below is the list of minimum dependencies required to use the progress bar component.
|-- @syncfusion/ej2-react-progressbar
|-- @syncfusion/ej2-base
|-- @syncfusion/ej2-data
|-- @syncfusion/ej2-svg-baseInstallation and configuration
To easily set up a React application, use create-vite-app, which provides a faster development environment, smaller bundle sizes, and optimized builds compared to traditional tools like create-react-app. For detailed steps, refer to the Vite installation instructions. Vite sets up your environment using JavaScript and optimizes your application for production.
Note: To create a React application using
create-react-app, refer to this documentation for more details.
To create a new React application, run the following command.
npm create vite@latest my-appTo set-up a React application in TypeScript environment, run the following command.
npm create vite@latest my-app -- --template react-ts
cd my-app
npm run devTo set-up a React application in JavaScript environment, run the following command.
npm create vite@latest my-app -- --template react
cd my-app
npm run devInstall Syncfusion® packages using below command.
npm install @syncfusion/ej2-react-progressbar --saveAdd Progressbar to the Project
Now, you can start adding Progress bar component in the application. For getting started, add the Progress bar component in src/App.tsx file using following code.
import {ProgressBarComponent} from '@syncfusion/ej2-react-progressbar';
import * as React from 'react';
function App() {
return ( <ProgressBarComponent/>)
};
export default App;Run the application
Now, we might create a simple progress bar sample as shown below.
import { ProgressBarComponent } from '@syncfusion/ej2-react-progressbar';
import * as React from "react";
import * as ReactDOM from "react-dom";
function App() {
return (<ProgressBarComponent id="linear" type='Linear' height='60' value={40} animation={{
enable: true,
duration: 2000,
delay: 0
}}>
</ProgressBarComponent>);
}
;
export default App;
ReactDOM.render(<App />, document.getElementById("container"));import { ProgressBarComponent } from '@syncfusion/ej2-react-progressbar';
import * as React from "react";
import * as ReactDOM from "react-dom";
function App() {
return(<ProgressBarComponent id="linear"
type='Linear'
height='60'
value={40}
animation={{
enable: true,
duration: 2000,
delay: 0
}}>
</ProgressBarComponent>
)
};
export default App;
ReactDOM.render(<App />, document.getElementById("container"));Now run the npm run dev command in the console to start the development server. This command compiles your code and serves the application locally, opening it in the browser.
npm run dev