1.0.0 • Published 4 years ago
react-desktop-only v1.0.0
react-desktop-only
A react component that will only display its children on desktop resolutions.
Installation
The react-desktop-only
package is not yet available from NPM.
Usage
The component can be used by wrapping child components to restrict their display to desktop devices.
import DesktopOnly from 'react-desktop-only'
const HeaderBar = (props) => (
<div>
<a href='/'>
<img src='/img/logo.png' />
</a>
<DesktopOnly>
<Menu />
</DesktopOnly>
</div>
)
By default, the component will display for screen resolutions above 768px. By passing a desktopSize
prop to the component, or by setting theme.desktopSize
in the styled-components theme.
Related
License
MIT