Getting Started
8 Jan 202411 minutes to read
This section explains how to create a simple Stepper and configure its available functionalities in the React environment.
Dependencies
The following list of dependencies is required to use the Stepper component in your application.
|-- @syncfusion/ej2-react-navigations
|-- @syncfusion/ej2-base
|-- @syncfusion/ej2-popups
|-- @syncfusion/ej2-navigations
|-- @syncfusion/ej2-react-base
Installation and Configuration
You can use Create-react-app
to setup the applications. To install create-react-app
run the following command.
npm install -g create-react-app
Start a new project using create-react-app command as follows
‘react-scripts-ts’ is used for creating React app with typescript.
Adding Syncfusion packages
All the available Essential JS 2 packages are published in npmjs.com public registry.
To install Stepper
component, use the following command
npm install @syncfusion/ej2-react-navigations --save
Adding CSS Reference
Import the Stepper component’s required CSS references as follows in src/App.css
.
@import "../node_modules/@syncfusion/ej2-base/styles/material.css";
@import "../node_modules/@syncfusion/ej2-popups/styles/material.css";
@import "../node_modules/@syncfusion/ej2-navigations/styles/material.css";
Adding Stepper component to the application
To include the Stepper component in your application, import the StepperComponent
from ej2-react-navigations
package in the App.tsx
.
To define each step, you can use the StepDirective
tag inside the StepsDirective
tag as shown in below code example.
import { StepperComponent, StepsDirective, StepDirective } from '@syncfusion/ej2-react-navigations';
import * as React from "react";
import * as ReactDOM from "react-dom";
import "./App.css";
function App() {
return (
<StepperComponent>
<StepsDirective>
<StepDirective/>
<StepDirective/>
<StepDirective/>
<StepDirective/>
<StepDirective/>
</StepsDirective>
</StepperComponent>
);
}
const root = ReactDOM.createRoot(document.getElementById("element"));
root.render(<App />);
Running the application
Run the application in the browser using the following command:
npm start
The following example shows a basic Stepper component.
import * as React from "react";
import * as ReactDom from "react-dom";
import { StepperComponent, StepsDirective, StepDirective } from '@syncfusion/ej2-react-navigations';
function App() {
return (
<div className="default-stepper">
<StepperComponent>
<StepsDirective>
<StepDirective/>
<StepDirective/>
<StepDirective/>
<StepDirective/>
<StepDirective/>
</StepsDirective>
</StepperComponent>
</div>
);
}
export default App;
ReactDom.render(<App />, document.getElementById("element"));
import * as React from "react";
import * as ReactDom from "react-dom";
import { StepperComponent, StepsDirective, StepDirective } from '@syncfusion/ej2-react-navigations';
function App() {
return (
<div className="default-stepper">
<StepperComponent>
<StepsDirective>
<StepDirective/>
<StepDirective/>
<StepDirective/>
<StepDirective/>
<StepDirective/>
</StepsDirective>
</StepperComponent>
</div>
);
}
export default App;
ReactDom.render(<App />, document.getElementById("element"));
Configure icon and label
You can define the step icon and label by setting the iconCss
and label
properties using the StepDirective
tag.
import * as React from "react";
import * as ReactDom from "react-dom";
import { StepperComponent, StepsDirective, StepDirective } from '@syncfusion/ej2-react-navigations';
function App() {
return (
<div className="stepper-icon-label">
<StepperComponent>
<StepsDirective>
<StepDirective iconCss= {'sf-icon-cart'} label= {'Cart'}/>
<StepDirective iconCss= {'sf-icon-user'} label= {'Address'}/>
<StepDirective iconCss= {'sf-icon-transport'} label= {'Delivery'}/>
<StepDirective iconCss= {'sf-icon-payment'} label= {'Payment'}/>
<StepDirective iconCss= {'sf-icon-success'} label= {'Ordered'}/>
</StepsDirective>
</StepperComponent>
</div>
);
}
export default App;
ReactDom.render(<App />, document.getElementById("element"));
import * as React from "react";
import * as ReactDom from "react-dom";
import { StepperComponent, StepsDirective, StepDirective } from '@syncfusion/ej2-react-navigations';
function App() {
return (
<div className="stepper-icon-label">
<StepperComponent>
<StepsDirective>
<StepDirective iconCss= {'sf-icon-cart'} label= {'Cart'}/>
<StepDirective iconCss= {'sf-icon-user'} label= {'Address'}/>
<StepDirective iconCss= {'sf-icon-transport'} label= {'Delivery'}/>
<StepDirective iconCss= {'sf-icon-payment'} label= {'Payment'}/>
<StepDirective iconCss= {'sf-icon-success'} label= {'Ordered'}/>
</StepsDirective>
</StepperComponent>
</div>
);
}
export default App;
ReactDom.render(<App />, document.getElementById("element"));
/* Represents the styles for loader */
#loader {
color: #008cff;
height: 40px;
left: 45%;
position: absolute;
top: 45%;
width: 30%;
}
@font-face {
font-family: 'Default';
src:
url(data:application/x-font-ttf;charset=utf-8;base64,AAEAAAAKAIAAAwAgT1MvM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wBpAG4AZwAgAFMAeQBuAGMAZgB1AHMAaQBvAG4AIABNAGUAdAByAG8AIABTAHQAdQBkAGkAbwB3AHcAdwAuAHMAeQBuAGMAZgB1AHMAaQBvAG4ALgBjAG8AbQAAAAACAAAAAAAAAAoAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAYBAgEDAQQBBQEGAQcADXRyYW5zcG9ydC12YW4LdXNlci1tb2RpZnkRc2hvcHBpbmctY2FydF8wMS0Lc3BlbmQtbW9uZXkFY2hlY2sAAAA=) format('truetype');
font-weight: normal;
font-style: normal;
}
.stepper-icon-label [class^="sf-icon-"], .stepper-icon-label [class*=" sf-icon-"] {
font-family: 'Default' !important;
speak: none;
font-style: normal;
font-weight: normal;
font-variant: normal;
text-transform: none;
line-height: inherit;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
.stepper-icon-label {
margin-top: 30px;
padding: 30px;
}
.stepper-icon-label .sf-icon-cart:before { content: "\e710"; }
.stepper-icon-label .sf-icon-user:before { content: "\e708"; }
.stepper-icon-label .sf-icon-transport:before { content: "\e702"; }
.stepper-icon-label .sf-icon-payment:before { content: "\e706"; }
.stepper-icon-label .sf-icon-success:before { content: "\e715"; }