An async loading button that shows a spinner and disables itself while a promise resolves.
Requires shadcn/ui initialized. Run npx shadcn@latest init if you haven't.
import { Button3 } from "@/components/beste/component/button3";
// Return a promise from onClick and the button handles loading itself:
// spinner + loadingLabel + disabled until the promise settles.
<Button3
label="Create account"
loadingLabel="Creating account..."
tone="primary" // "dark" (default) | "primary" | "outline"
type="submit" // "button" (default) | "submit"
onClick={async () => {
await new Promise((resolve) => setTimeout(resolve, 2000));
console.log("account created");
}}
/>
// Or drive it yourself with your own state:
// <Button3 label="Save changes" loading={isSaving} />