Skip to content

Commit 7766ec6

Browse files
committed
button - added type property
1 parent 0fe796b commit 7766ec6

File tree

4 files changed

+265
-178
lines changed

4 files changed

+265
-178
lines changed

library/src/components/Button.tsx

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,19 @@ export type ButtonProps = {
1414
iconBefore?: React.ReactNode
1515
iconAfter?: React.ReactNode
1616
isDisabled?: boolean
17-
onClick: () => void
18-
onDoubleClick?: () => void
19-
onMouseDown?: () => void
20-
onMouseUp?: () => void
2117
children?: React.ReactNode
2218
style?: CSSProperties
2319
className?: string
24-
}
20+
} & Pick<
21+
React.ButtonHTMLAttributes<HTMLButtonElement>,
22+
| "type"
23+
| "onClick"
24+
| "onDoubleClick"
25+
| "onMouseDown"
26+
| "onMouseUp"
27+
| "title"
28+
| "aria-label"
29+
>
2530

2631
export const Button = ({
2732
label = "",
@@ -31,21 +36,14 @@ export const Button = ({
3136
iconAfter,
3237
isDisabled = false,
3338
style,
34-
onClick,
35-
onDoubleClick,
36-
onMouseDown,
37-
onMouseUp,
3839
children,
3940
className,
41+
...props
4042
}: ButtonProps) => {
4143
return (
4244
<button
4345
title={title}
4446
aria-label={label}
45-
onClick={onClick}
46-
onDoubleClick={onDoubleClick}
47-
onMouseDown={onMouseDown}
48-
onMouseUp={onMouseUp}
4947
style={style}
5048
className={twMerge(
5149
InteractiveStyles[appearance],
@@ -54,6 +52,7 @@ export const Button = ({
5452
className,
5553
)}
5654
disabled={isDisabled}
55+
{...props}
5756
>
5857
{iconBefore}
5958
{children}

0 commit comments

Comments
 (0)