question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Button] Is the 'type' prop really removed from ButtonBase?

See original GitHub issue

According 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:open
  • Created 3 years ago
  • Comments:14 (12 by maintainers)

github_iconTop GitHub Comments

2reactions
eps1loncommented, Jul 27, 2020

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 other type 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.

2reactions
oliviertassinaricommented, Jul 25, 2020

@cmeeren I think that we should document the custom default prop (type="button" over type="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_r423994251

Should we remove the custom default type value?

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found