LogoLogo
GitHub repository
GitHub repository
    Documentation
  • Overview
  • Getting Started
  • Guides


  • Hooks

  • Components


    • AsyncButton
    • AsyncIconButton
    • CodeBlock
    • CopyButton
    • Enumeration
    • ExampleCard
    • Icon
    • InlineCode
    • Logo
    • PageLoadingIndicator
    • PageOverview
    • Paragraph
    • QuoteBlock
    • SmartImage
    • SmartLink
    • StyleLink

AsyncButton

A button that is automatically disabled after being clicked, until the async action is complete.

Props

The same as Joy UI's Button component, except for the following:
  • onClick can be an async function.

Examples

Button that loads for a few seconds


1<AsyncButton
2 onClick={async () => {
3 await wait(5_000);
4 alert("You waited 5 seconds!");
5 }}
6>
7 Click me!
8</AsyncButton>
1<AsyncButton
2 onClick={async () => {
3 await wait(5_000);
4 alert("You waited 5 seconds!");
5 }}
6>
7 Click me!
8</AsyncButton>

See also


LogoLogo