Skip to content

Commit

Permalink
feat(IconButton): add default type to IconButton (#3732)
Browse files Browse the repository at this point in the history
* feat(IconButton): add default type to IconButton

* Create wild-snakes-talk.md
  • Loading branch information
joshblack authored Sep 12, 2023
1 parent 8834026 commit 8928acc
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
7 changes: 7 additions & 0 deletions .changeset/wild-snakes-talk.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"@primer/react": minor
---

Add default `type="button"` to `IconButton` component

<!-- Changed components: IconButton -->
2 changes: 1 addition & 1 deletion src/Button/IconButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const IconButton = forwardRef(({sx: sxProp = defaultSxProp, icon: Icon, ...props

return (
// @ts-expect-error StyledButton wants both Anchor and Button refs
<ButtonBase icon={Icon} data-component="IconButton" sx={sxStyles} {...props} ref={forwardedRef} />
<ButtonBase icon={Icon} data-component="IconButton" sx={sxStyles} type="button" {...props} ref={forwardedRef} />
)
}) as PolymorphicForwardRefComponent<'button' | 'a', IconButtonProps>

Expand Down

0 comments on commit 8928acc

Please sign in to comment.