Search results

Spinner

Change spinner position

Spinner position can be changed by modifying the position property of spinSettings. By default, the spinner is positioned at the left of the ProgressButton. You can position it at the left, right, top, bottom, or center of the text content.

Change spinner size

Spinner size can be changed by modifying the width property of spinSettings. In this demo, the width is set to 20 to change the spinner size.

Spinner template

You can use custom spinner by specifying the template property of spinSettings with custom styles.

The following sample demonstrates the above functionalities of the spinner.

Source
Preview
app.tsx
index.html
spinner.css
import * as React from 'react';
import * as ReactDom from 'react-dom';
import { ProgressButtonComponent, SpinSettings } from '@syncfusion/ej2-react-splitbuttons';

class App extends React.Component<{}, {}> {

  private spinSettings : SpinSettings = { position: 'Right', width: 20, template: '<div class="template"></div>' };

  render() {
    return (
      <ProgressButtonComponent content='Submit' spinSettings={this.spinSettings}></ProgressButtonComponent>
    );
  }
}
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" />
    <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>
@keyframes custom-rolling {
0% {
      -webkit-transform: rotate(0deg);
      transform: rotate(0deg);
  }
100% {
      -webkit-transform: rotate(360deg);
      transform: rotate(360deg);
  }
}

.template {
  border: 2px solid green;
  border-style: dotted;
  border-radius: 50%;
  border-top-color: transparent;
  border-bottom-color: transparent;
  height: 16px;
  width: 16px;
}

.template {
  -webkit-animation: custom-rolling 1.3s linear infinite;
  animation: custom-rolling 1.3s linear infinite;
}

Progress

Content animation

The content of the ProgressButton can be animated during progress using the effect property of animationSettings. You can also set custom duration and timing function using the duration and easing properties. The possible effect values are None, SlideLeft, SlideRight, SlideUp, SlideDown, ZoomIn, and ZoomOut.

Source
Preview
app.tsx
index.html
import * as React from 'react';
import * as ReactDom from 'react-dom';
import { ProgressButtonComponent, SpinSettings, AnimationSettings } from '@syncfusion/ej2-react-splitbuttons';

class App extends React.Component<{}, {}> {

  private animationSettings: AnimationSettings = { effect: 'SlideLeft',  duration: 500, easing: 'linear' };
  private spinSettings : SpinSettings = { position: 'Center' };

  render() {
    return (
      <ProgressButtonComponent content='Slide Left' enableProgress animationSettings={this.animationSettings} spinSettings={this.spinSettings}></ProgressButtonComponent>
    );
  }
}
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" />
    <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>

Change step of the ProgressButton

The progress can be visualized at the specified interval by changing the step property in the begin event of the ProgressButton. In this demo, the step property is set to 20 to show progress at every 20% increment.

Source
Preview
app.tsx
index.html
import * as React from 'react';
import * as ReactDom from 'react-dom';
import { ProgressButtonComponent, ProgressEventArgs } from '@syncfusion/ej2-react-splitbuttons';

class App extends React.Component<{}, {}> {

  private begin(args: ProgressEventArgs): void {
      args.step = 20;
  }

  render() {
    return (
      <ProgressButtonComponent content='Progress Step' enableProgress begin={this.begin} cssClass='e-hide-spinner'></ProgressButtonComponent>
    );
  }
}
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" />
    <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>

The class e-hide-spinner hides the spinner in the ProgressButton, For more information, see hide spinner section.

Change progress dynamically

The progress can be changed dynamically by modifying the percent property in the ProgressButton events. In this demo, on 40% completion of progress, the percent property is set to 90 to show dynamic change of the progress.

Source
Preview
app.tsx
index.html
import * as React from 'react';
import * as ReactDom from 'react-dom';
import { ProgressButtonComponent, ProgressEventArgs } from '@syncfusion/ej2-react-splitbuttons';

class App extends React.Component<{}, {}> {
  constructor() {
    this.state = { content: 'Progress' };
  }

  private begin(args: ProgressEventArgs): void {
    this.setState({ content: 'Progress ' + args.percent + '%' });
  }

  private progress(args: ProgressEventArgs): void {
    this.setState({ content: 'Progress ' + args.percent + '%' });
    if (args.percent === 40) {
      args.percent = 90;
    }
  }

  private end(args: ProgressEventArgs): void {
    this.setState({ content: 'Progress ' + args.percent + '%' });
  }

  render() {
    return (
      <ProgressButtonComponent content={this.state.content} enableProgress duration={15000} begin={this.begin.bind(this)} progress={this.progress.bind(this)} end={this.end.bind(this)} cssClass='e-hide-spinner'></ProgressButtonComponent>
    );
  }
}
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" />
    <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>

The method dataBind applies the property changes immediately to the component.

Start and stop methods

You can pause and resume the progress using the stop and start methods, respectively. In this demo, clicking the ProgressButton will pause and resume the progress.

Source
Preview
app.tsx
index.html
icon.css
import * as React from 'react';
import * as ReactDom from 'react-dom';
import { ProgressButtonComponent, ProgressEventArgs } from '@syncfusion/ej2-react-splitbuttons';

class App extends React.Component<{}, {}> {
  constructor() {
    this.state = { content: 'Download', iconCss: 'e-btn-sb-icon e-download' };
  }

  private progressBtn: ProgressButtonComponent;

  private end(args: ProgressEventArgs): void {
    this.setState({ content: 'Download', iconCss: 'e-btn-sb-icon e-download' });
  }

  private clickHandler(): void {
    if (this.state.content === 'Download') {
        this.setState({ content: 'Pause', iconCss: 'e-btn-sb-icon e-pause' });
        this.setState();
    }
    else if (this.state.content === 'Pause') {
        this.setState({ content: 'Resume', iconCss: 'e-btn-sb-icon e-play' });
        this.progressBtn.stop();
    }
    else if (this.state.content === 'Resume') {
        this.setState({ content: 'Pause', iconCss: 'e-btn-sb-icon e-pause' });
        this.progressBtn.start();
    }
  }

  render() {
    return (
      <ProgressButtonComponent content={this.state.content} enableProgress duration={4000} iconCss={this.state.iconCss} end={this.end.bind(this)} cssClass='e-hide-spinner' onClick={this.clickHandler.bind(this)} ref={(scope)=>{this.progressBtn=scope;}}></ProgressButtonComponent>
    );
  }
}
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" />
    <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>
@font-face {
	font-family: 'btn-icon';
	src:
	url(data:application/x-font-ttf;charset=utf-8;base64,AAEAAAAKAIAAAwAgT1MvMj1tSfgAAAEoAAAAVmNtYXDnH+dzAAABoAAAAEJnbHlm1v48pAAAAfgAAAQYaGVhZBOPfZcAAADQAAAANmhoZWEIUQQJAAAArAAAACRobXR4IAAAAAAAAYAAAAAgbG9jYQN6ApQAAAHkAAAAEm1heHABFQCqAAABCAAAACBuYW1l07lFxAAABhAAAAIxcG9zdK9uovoAAAhEAAAAgAABAAAEAAAAAFwEAAAAAAAD9AABAAAAAAAAAAAAAAAAAAAACAABAAAAAQAAJ1LUzF8PPPUACwQAAAAAANg+nFMAAAAA2D6cUwAAAAAD9AP0AAAACAACAAAAAAAAAAEAAAAIAJ4AAwAAAAAAAgAAAAoACgAAAP8AAAAAAAAAAQQAAZAABQAAAokCzAAAAI8CiQLMAAAB6wAyAQgAAAIABQMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUGZFZABA5wDnBgQAAAAAXAQAAAAAAAABAAAAAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAAAAACAAAAAwAAABQAAwABAAAAFAAEAC4AAAAEAAQAAQAA5wb//wAA5wD//wAAAAEABAAAAAEAAgADAAQABQAGAAcAAAAAAAAADgAkADIAhAEuAewCDAAAAAEAAAAAA2ED9AACAAA3CQGeAsT9PAwB9AH0AAACAAAAAAP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GAQcBCAEJAAptZWRpYS1wbGF5C21lZGlhLXBhdXNlDmFycm93aGVhZC1sZWZ0BHN0b3AJbGlrZS0tLTAxBGNvcHkQLWRvd25sb2FkLTAyLXdmLQAA) format('truetype');
	font-weight: normal;
	font-style: normal;
}

.e-btn-sb-icon {
	font-family: 'btn-icon' !important;
	speak: none;
	font-size: 55px;
	font-style: normal;
	font-weight: normal;
	font-variant: normal;
	text-transform: none;
	line-height: 1;
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
}

.e-download::before {
  content: '\e706';
}

.e-play::before {
  content: '\e700';
}

.e-pause::before {
  content: '\e701';
}

See Also