Skip to content

Commit 8666450

Browse files
committed
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
1 parent 7f785bd commit 8666450

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

react/Buttons/Readme.md

+8
Original file line numberDiff line numberDiff 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.
8+
19
### Default
210

311
```jsx

0 commit comments

Comments
 (0)