You can change the text content and styles of the ProgressButton during progress by changing the text content and the cssClass
property at the begin
and end
events.
import { ProgressButtonComponent } from '@syncfusion/ej2-react-splitbuttons';
import * as React from 'react';
import * as ReactDom from 'react-dom';
class App extends React.Component<{}, {content: string, cssClass: string}> {
constructor(props: any) {
super(props);
this.state = { content: 'Upload', cssClass: 'e-hide-spinner' };
}
private begin(): void {
this.setState({ content: 'Uploading...', cssClass: 'e-hide-spinner e-info' });
}
private end(): void {
this.setState({ content: 'Success', cssClass: 'e-hide-spinner e-success' });
setTimeout(() => {
this.setState({ content: 'Upload', cssClass: 'e-hide-spinner' });
}, 500)
}
public render() {
return (
<ProgressButtonComponent content={this.state.content} enableProgress cssClass={this.state.cssClass} duration={4000} begin={this.begin.bind(this)} end={this.end.bind(this)}/>
);
}
}
ReactDom.render(<App />, document.getElementById('progress-button'));
<!DOCTYPE html>
<html lang="en">
<head>
<title>Syncfusion React Progress Button</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="description" content="This demo for React Progress button has progress indicator and spinner. It supports texts, icons, styles, sizes, positions, and its customization." />
<meta name="author" content="Syncfusion" />
<link href="//cdn.syncfusion.com/ej2/ej2-base/styles/material.css" rel="stylesheet" />
<link href="//cdn.syncfusion.com/ej2/ej2-buttons/styles/material.css" rel="stylesheet" />
<link href="//cdn.syncfusion.com/ej2/ej2-popups/styles/material.css" rel="stylesheet" />
<link href="//cdn.syncfusion.com/ej2/ej2-splitbuttons/styles/material.css" rel="stylesheet" />
<link href="index.css" rel="stylesheet" />
<link href="spinner.css" rel="stylesheet" />
<link href="progress.css" rel="stylesheet" />
<link href="icon.css" rel="stylesheet" />
<link href="events.css" rel="stylesheet" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/systemjs/0.19.38/system.js"></script>
<script src="systemjs.config.js"></script>
</head>
<body>
<div id='progress-button'>
<div id='loader'>Loading....</div>
</div>
</body>
</html>
import { ProgressButtonComponent } from '@syncfusion/ej2-react-splitbuttons';
import * as React from 'react';
import * as ReactDom from 'react-dom';
class App extends React.Component {
constructor(props) {
super(props);
this.state = { content: 'Upload', cssClass: 'e-hide-spinner' };
}
begin() {
this.setState({ content: 'Uploading...', cssClass: 'e-hide-spinner e-info' });
}
end() {
this.setState({ content: 'Success', cssClass: 'e-hide-spinner e-success' });
setTimeout(() => {
this.setState({ content: 'Upload', cssClass: 'e-hide-spinner' });
}, 500);
}
render() {
return (<ProgressButtonComponent content={this.state.content} enableProgress cssClass={this.state.cssClass} duration={4000} begin={this.begin.bind(this)} end={this.end.bind(this)}/>);
}
}
ReactDom.render(<App />, document.getElementById('progress-button'));