-
Notifications
You must be signed in to change notification settings - Fork 99
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(Button): allow to pass any valid <button>
or <a>
HTML attributes
#1594
base: main
Are you sure you want to change the base?
Conversation
Playwright Test Component is ready. |
Preview is ready. |
3569fb0
to
a7576c6
Compare
@@ -125,64 +122,81 @@ const ButtonWithHandlers = React.forwardRef<HTMLElement, ButtonProps>(function B | |||
view, | |||
}, | |||
}); | |||
|
|||
if (onClickCapture) { | |||
onClickCapture(event as any); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is type cast used?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It requires weird type, intersection of HTMLButtonElement
and HTMLAnchorElement
return ( | ||
<button {...props} style={{boxShadow: '2px 2px 2px 2px deepskyblue'}}> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why element type changed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To ensure any root tag is valid
@amje |
Yes, it's valid |
This PR introduces an easier way to pass any extra properties to the component and deprecates
extraProps
prop:By default, extra properties extend
React.ButtonHTMLAttributes
and whenhref
property is passed they extendReact.AnchorHTMLAttributes
.PR potentially will break types because
ButtonProps
can no longer be extended in interface declaration: