Skip to content

Commit ed573df

Browse files
author
Luka Jeran
authored
Merge pull request #43 from oasisprotocol/lw/default-button-type
Change default Button type from "submit" to "button"
2 parents c52ca6a + de21f6f commit ed573df

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

src/components/ui/button.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,17 @@ export interface ButtonProps
3737
extends React.ButtonHTMLAttributes<HTMLButtonElement>,
3838
VariantProps<typeof buttonVariants> {
3939
asChild?: boolean
40+
/** Defaults to type="button" */
41+
type?: 'submit' | 'reset' | 'button'
4042
}
4143

4244
const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
43-
({ className, variant, size, asChild = false, ...props }, ref) => {
45+
({ className, variant, size, asChild = false, type = 'button', ...props }, ref) => {
4446
const Comp = asChild ? Slot : "button"
4547
return (
4648
<Comp
4749
className={cn(buttonVariants({ variant, size, className }))}
50+
type={type}
4851
ref={ref}
4952
{...props}
5053
/>

0 commit comments

Comments
 (0)