You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
docs: Describe default type attribute in Buttons documentation
MUI documentation does not describe default button's `type`, nor
explain that is it possible to set classic HTML attributes, so it is
easy to forget applying the correct button type when inside of a form
This is what happened on a previous PR when migrating from old
`react/deprecated/Button` to new `react/Buttons` as those components
have opposite default behaviors
Related PR: cozy/cozy-settings#674
Copy file name to clipboardExpand all lines: react/Buttons/Readme.md
+8
Original file line number
Diff line number
Diff line change
@@ -1,3 +1,11 @@
1
+
Buttons are a wrapper arround [MuiButton](https://mui.com/material-ui/react-button/) integrated with Cozy's design system
2
+
3
+
The `Button` component will produce an HTML `<button>`. The React component accepts classic HTML attributes (i.e. `type`) through React props.
4
+
5
+
By default the HTML `<button>` is rendered with `type="button"` attribute, so its click effect must be controlled by React (i.e. by using `onClick` event).
6
+
7
+
If the button is located inside of a form, you can set the props `type="submit"` to the React component, so clicking on it would trigger the form's `onSubmit` event.
0 commit comments