[Hidden] Remove component
See original GitHub issue- The issue is present in the latest release.
- I have searched the issues of this repository and believe that this is not a duplicate.
Current Behavior 😯
The Hidden component documentation states: “Any other props supplied will be provided to the root element (native element).” (see https://material-ui.com/api/hidden/) However, the typescript declaration file for the component does not declare all the native underlying div properties, and the properties are not passed down, except for the className (which is not declared anyway for typescript users). I use the CssHidden implementation of the component.
Expected Behavior 🤔
I should be able to add custom styles to the underlying div element using className or style properties.
Steps to Reproduce 🕹
Very simple: create a typescript project, use <Hidden mdUp implementation="css" className="whatever">
, it does not compile.
Context 🔦
I want to add custom style to the div element generated by the Hidden component, using either className or style property (I need height=“100%” at each level here).
I made this workaround for now:
const FixHidden = Hidden as React.ComponentType<HiddenProps & {className: string}>
Issue Analytics
- State:
- Created 4 years ago
- Comments:7 (3 by maintainers)
Top GitHub Comments
@fromi Thank you for opening this issue! I think that it’s a great opportunity to take a step back and to reconsider what problem we wish this component to solve and how it fits into the global picture.
I have been wondering about removing this component in v5. Basically, developers could migrate way from this component.
HiddenCss
with the system. For instance:would turn into:
This is documented in https://material-ui.com/system/display/#hiding-elements and comes from prior-art in:
HiddenJs
with useMediaQuery. For instance:would turn into:
So in this context, I think that we could keep pushing forward in a direction that gets ride of Hidden. Meaning, a deprecation in v4 and removal in v5. What do you guys think?
Regarding #22281, I don’t understand why you’ve closed that issue, when this issue only proposes a removal of the Hidden component, and not Grid support for custom breakpoints.