Getting Started
3 Dec 20233 minutes to read
The following section explains the required steps to build the Signature component with its basic usage in step-by-step procedure.
To get start quickly with Signature Component using React, you can check on this video:
Dependencies
The following list of dependencies are required to use the Signature component in your application.
|-- @syncfusion/ej2-react-base
Setup your development environment
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
To set-up a React application in TypeScript environment, run the following command.
npx create-react-app my-app --template typescript
cd my-app
npm start
To set-up a React application in JavaScript environment, run the following command.
npx create-react-app my-app
cd my-app
npm start
Adding Syncfusion packages
All the available Essential JS 2 packages are published in npmjs.com public registry.
You can choose the component that you want to install. For this application, we are going to use Signature component.
To install Signature component, use the following command
npm install @syncfusion/ej2-react-inputs –save
The above command installs Signature dependencies which are required to render the component in the React
environment.
Adding Style sheet to the Application
Add Signature component’s styles as given below in App.css
.
@import "../node_modules/@syncfusion/ej2-base/styles/material.css";
@import "../node_modules/@syncfusion/ej2-inputs/styles/material.css";
Add Signature to the project
Now, you can create Signature
component in the application. Add Signature
component in src/App.tsx
file using the following code snippet.
import { SignatureComponent } from '@syncfusion/ej2-react-inputs';
import * as React from 'react';
function App() {
return (<div style=>
<SignatureComponent id='signature'></SignatureComponent>
</div>);
}
export default App;
Run the application
Use the npm run start
command to run the application in the browser.
npm run start
The following example shows the default Signature.
import { SignatureComponent } from '@syncfusion/ej2-react-inputs';
import * as React from "react";
import * as ReactDOM from "react-dom";
// initializes Signature component.
function App() {
return (<div id='container'>
<div id='signature-control'>
<h4>Sign here</h4>
<SignatureComponent id='signature'/>
</div>
</div>);
}
;
export default App;
ReactDOM.render(<App />, document.getElementById('element'));
import { SignatureComponent } from '@syncfusion/ej2-react-inputs';
import * as React from "react";
import * as ReactDOM from "react-dom";
// initializes Signature component.
function App() {
return (
<div id='container'>
<div id='signature-control'>
<h4>Sign here</h4>
<SignatureComponent id='signature'/>
</div>
</div>
);
};
export default App;
ReactDOM.render(<App />, document.getElementById('element'));