Button Pending

PreviousNext

button-pending-demo

Docs
intentuipage

Preview

Loading preview…
components/docs/buttons/button/button-pending-demo.tsx
"use client"

import { PlusIcon } from "@heroicons/react/20/solid"
import { useState } from "react"
import { Button } from "@/components/ui/button"
import { ProgressCircle } from "@/components/ui/progress-circle"

export default function ButtonPendingDemo() {
  const [isLoading, setLoading] = useState(false)

  const handlePress = () => {
    setLoading(true)
    setTimeout(() => {
      setLoading(false)
    }, 4500)
  }
  return (
    <Button onPress={handlePress} isPending={isLoading}>
      {({ isPending }) => (
        <>
          {isPending ? <ProgressCircle isIndeterminate aria-label="Creating..." /> : <PlusIcon />}
          {isLoading ? "Creating..." : "Create"}
        </>
      )}
    </Button>
  )
}

Installation

npx shadcn@latest add @intentui/button-pending-demo

Usage

Usage varies by registry entry. Refer to the registry docs or source files below for details.