Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

Update Button.tsx

Jonathan Summers-Muirecd47f67c353
diff --git a/packages/ui/src/components/Button/Button.tsx b/packages/ui/src/components/Button/Button.tsx
index bb4d0eaa138..5fe78850166 100644
--- a/packages/ui/src/components/Button/Button.tsx
+++ b/packages/ui/src/components/Button/Button.tsx
@@ -148,15 +148,28 @@ export interface ButtonProps
}
const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
- ({ asChild = false, size = 'tiny', type = 'primary', children, ...props }, ref) => {
+ (
+ {
+ asChild = false,
+ size = 'tiny',
+ type = 'primary',
+ children,
+ loading,
+ block,
+ icon,
+ iconRight,
+ iconLeft,
+ ...props
+ },
+ ref
+ ) => {
const Comp = asChild ? Slot : 'button'
-
- const { className, disabled, loading, icon, iconLeft, iconRight, block } = props
-
+ const { className, disabled } = props
const showIcon = loading || icon
-
// decrecating 'showIcon' for rightIcon
const _iconLeft: React.ReactNode = icon ?? iconLeft
+ // if loading, button is disabled
+ props.disabled = loading ? true : props.disabled
return (
<Comp