@@ -30,6 +47,9 @@ export class ButtonDemo extends Component {
+
Loading
+
+
Severities
diff --git a/src/showcase/button/ButtonDoc.js b/src/showcase/button/ButtonDoc.js
index 017d4c64c6..1074fbc4b4 100644
--- a/src/showcase/button/ButtonDoc.js
+++ b/src/showcase/button/ButtonDoc.js
@@ -19,6 +19,24 @@ import './ButtonDemo.css';
export class ButtonDemo extends Component {
+ constructor(props) {
+ super(props)
+ this.state = {
+ loading: false,
+ check: false,
+ disabled: false
+ }
+
+ this.onClick = this.onClick.bind(this);
+ }
+
+ onClick = () => {
+ this.setState({ check: false, loading: true, disabled: true })
+ setTimeout(() => {
+ this.setState({ loading: false, check: true, disabled: false })
+ }, 2000)
+ }
+
render() {
return (
@@ -33,6 +51,9 @@ export class ButtonDemo extends Component {
+
Loading
+
+
Severities
@@ -144,11 +165,28 @@ export class ButtonDemo extends Component {
'hooks': {
tabName: 'Hooks Source',
content: `
-import React from 'react';
+import React, { useState } from 'react';
import { Button } from 'primereact/button';
import './ButtonDemo.css';
const ButtonDemo = () => {
+
+ const [loading, setLoading] = useState(false);
+ const [check, setCheck] = useState(false);
+ const [disabled, setDisabled] = useState(false);
+
+ const onClick = () => {
+ setLoading(true);
+ setCheck(false);
+ setDisabled(true);
+
+ setTimeout(() => {
+ setLoading(false);
+ setCheck(true);
+ setDisabled(false);
+ }, 2000)
+ }
+
return (
@@ -162,6 +200,10 @@ const ButtonDemo = () => {
+
+
Loading
+
+
Severities
@@ -272,12 +314,28 @@ const ButtonDemo = () => {
'ts': {
tabName: 'TS Source',
content: `
-import React from 'react';
+import React, { useState } from 'react';
import { Button } from 'primereact/button';
import './ButtonDemo.css';
const ButtonDemo = () => {
+ const [loading, setLoading] = useState(false);
+ const [check, setCheck] = useState(false);
+ const [disabled, setDisabled] = useState(false);
+
+ const onClick = () => {
+ setLoading(true);
+ setCheck(false);
+ setDisabled(true);
+
+ setTimeout(() => {
+ setLoading(false);
+ setCheck(true);
+ setDisabled(false);
+ }, 2000)
+ }
+
return (
@@ -291,6 +349,9 @@ const ButtonDemo = () => {
+
Loading
+
+
Severities
@@ -482,6 +543,14 @@ import { Button } from 'primereact/button';
`}
+
+
Loading
+
Loading on a button is specified with loading property and position is configured using iconPos attribute. Default
+ loading position is "left" and alternative is "right". To display only a loading, leave label as undefined.
+
+{`
+
+`}
Events