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.

[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:closed
  • Created 4 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

8reactions
oliviertassinaricommented, Apr 10, 2020

@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.

  1. Replace HiddenCss with the system. For instance:
<Hidden mdDown implementation="css"><A /></Hidden>

would turn into:

<Box display={{ xs: 'none', lg: 'block' }} /><A /></Box>

This is documented in https://material-ui.com/system/display/#hiding-elements and comes from prior-art in:

  1. Replace HiddenJs with useMediaQuery. For instance:
<Hidden lgUp implementation="js"><A /></Hidden>

would turn into:


const hidden = useMediaQuery(theme => theme.breakpoints.up('lg')))

return hidden ? null : <A />;

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?

0reactions
kongweiying2commented, Apr 27, 2021

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

React: hiding vs removing components [closed] - Stack Overflow
Here's the case. In React sometimes we want to hide components. For example, when user opens new page in SPA, when some toast...
Read more >
Hide published styles and components – Figma Help Center
There are a couple of ways to remove a style: hide it when publishing, or delete it entirely. In this article, we'll cover...
Read more >
Remove Hidden Windows Components - Tweaks.com
Remove Hidden Windows Components · 1) Click Start. · 2) Click Run. · 3) Type: notepad.exe C:\windows\inf\sysoc.inf · 4) In notepad, click Edit...
Read more >
Hidden Components - the Draftbit Docs!
To hide a component, hover over the component in the Components tree to hide a component, and click on the eye 👁️ icon....
Read more >
[Hidden] Remove component #19704 - mui/material-ui - GitHub
Current Behavior. The Hidden component documentation states: "Any other props supplied will be provided to the root element (native element).
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