Super Sale Limited Time 50% OFF for All-Access Plans
Save 50% Now

indicator-label and indicator-progress in UserEditModalForm.tsx - make the spinner appear (User Management app)


Hi,

On UserEditModalForm.tsx there is a button:

<button
type="submit"
className="btn btn-primary"
data-kt-users-modal-action="submit"
disabled={isUserLoading || formik.isSubmitting || !formik.isValid || !formik.touched}
>
<span className="indicator-label">Submit</span>
{(formik.isSubmitting || isUserLoading) && (
<span className="indicator-progress">
Please wait...{" "}
<span className="spinner-border spinner-border-sm align-middle ms-2"></span>
</span>
)}
</button>

I'm trying to display the span with the class indicator-progress but it won't show up when I click the submit button.

I noticed there are some classes in the file _indicator.scss:


//
// Indicator
//

.indicator-progress {
display: none;

[data-kt-indicator="on"] > & {
display: inline-block;
}
}

.indicator-label {
[data-kt-indicator="on"] > & {
display: none;
}
}


I don't see data-kt-indicator anywhere else though.

What do I need to do in order to make Please wait... with the spinner appear when I click on the submit button?


Text formatting options
Submit
Click any option to insert into your comment. Select text first to wrap it.
  • **text** to make things bold
  • *text* to emphasize
  • ### Heading to make headings
  • [link text](url) for links
  • ![alt text](image-url) to paste in an image
  • - item to make a list
  • 1. item to make an ordered list
  • > quote to quote somebody
  • `code` for single line of code
  • ```js ... ``` for JS code block
  • ```html ... ``` for HTML code block
  • ```scss ... ``` for SCSS code block
  • ```php ... ``` for PHP code block
  • --- for a horizontal rule
  • happy  :)
  • shocked  :|
  • sad  :(

Replies (2)


Thanks!



Hi,

Sorry for the later reply.

In our UserEditModalForm.tsx we are using a different loading approach, if you want to enable loading inside a button you can render button content conditionally as shown below.


const [loadingState, setLoadingState] = useState(false);

<button
type="submit"
className="btn btn-primary"
data-kt-indicator={ loadingState ? "on" : "off" }
>
{ !loadingState && <span className="indicator-label">Submit</span> }
{ loadingState && (
<span className="indicator-progress">
Please wait...{" "}
<span className="spinner-border spinner-border-sm align-middle ms-2"></span>
</span>
) }
</button>


Regards,
Lauris Stepanovs,
Keenthemes Support Team


Text formatting options
Submit
Click any option to insert into your comment. Select text first to wrap it.
  • **text** to make things bold
  • *text* to emphasize
  • ### Heading to make headings
  • [link text](url) for links
  • ![alt text](image-url) to paste in an image
  • - item to make a list
  • 1. item to make an ordered list
  • > quote to quote somebody
  • `code` for single line of code
  • ```js ... ``` for JS code block
  • ```html ... ``` for HTML code block
  • ```scss ... ``` for SCSS code block
  • ```php ... ``` for PHP code block
  • --- for a horizontal rule
  • happy  :)
  • shocked  :|
  • sad  :(
Text formatting options
Submit
Click any option to insert into your comment. Select text first to wrap it.
  • **text** to make things bold
  • *text* to emphasize
  • ### Heading to make headings
  • [link text](url) for links
  • ![alt text](image-url) to paste in an image
  • - item to make a list
  • 1. item to make an ordered list
  • > quote to quote somebody
  • `code` for single line of code
  • ```js ... ``` for JS code block
  • ```html ... ``` for HTML code block
  • ```scss ... ``` for SCSS code block
  • ```php ... ``` for PHP code block
  • --- for a horizontal rule
  • happy  :)
  • shocked  :|
  • sad  :(