fix: ensure button type is correctly set when not explicitly defined

This commit is contained in:
Mohammed Imran
2025-10-16 10:29:10 +05:30
parent 78a9fe9dc5
commit 901013ccd1
+3
View File
@@ -55,6 +55,8 @@ const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
ref, ref,
) => { ) => {
const Comp = asChild ? Slot : "button"; const Comp = asChild ? Slot : "button";
const type = props.type ?? undefined;
return ( return (
<> <>
<Comp <Comp
@@ -65,6 +67,7 @@ const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
ref={ref} ref={ref}
{...props} {...props}
disabled={isLoading || props.disabled} disabled={isLoading || props.disabled}
type={type}
> >
{isLoading && <Loader2 className="animate-spin" />} {isLoading && <Loader2 className="animate-spin" />}
<Slottable>{children}</Slottable> <Slottable>{children}</Slottable>