[Button] Is the 'type' prop really removed from ButtonBase?
See original GitHub issueAccording to the docs, ButtonBase
no longer has a type
prop (which had values submit
, reset
, and button
). Is this a deliberate change, or a documentation bug?
I’m asking because I’m generating MUI bindings from the docs. ButtonBase props are inherited by many other components, so I don’t want to remove it unless it’s intended.
Issue Analytics
- State:
- Created 3 years ago
- Comments:14 (12 by maintainers)
Top Results From Across the Web
[Button] Is the 'type' prop really removed from ButtonBase?
According to the docs, ButtonBase no longer has a type prop (which had values submit, reset, and button). Is this a deliberate change, ......
Read more >index.js:1 Warning: Failed prop type: The prop `buttonRef` of ...
I´m using MUI Datatables ( V.3.7.8 ), and this error " index.js:1 Warning: Failed prop type: The prop buttonRef of ForwardRef(ButtonBase) ...
Read more >ListItemButton API - Material UI - MUI
API reference docs for the React ListItemButton component. Learn about the props, CSS, and other APIs of this exported module.
Read more >Button - NativeBase
Props to be passed to the button when button is focused. Type: Partial<IButtonProps>. rightIcon.
Read more >Making your components extensible with TypeScript
The <Button /> we have so far isn't really useful, is it? ... import * as React from "react"; type Props = {...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I don’t think we intended to remove it from the docs. Just that we don’t want to restrict it at runtime because this might cause false positives. We never had any reports about
<Button component="a" dowload type="audio/ogg" />
but this doesn’t mean that there are none. The runtime warning could’ve prevented legitimate usage of othertype
values.I think documenting the allowed types for the default case and then widening the allowed types at runtime to
PropTypes.string
is a good compromise. In the end html validators or other 3rd party tools are probably better suited for verifying the output.@cmeeren I think that we should document the custom default prop (
type="button"
overtype="submit"
), it can be confusing when building forms otherwise (I fell into this trap in the past building forms with our button). See https://github.com/mui-org/material-ui/pull/21002#discussion_r423994251Should we remove the custom default type value?