Skip to main content

Hidden: React

Hide content if the screen size matches the applied breakpoint (or another media query).

Installation

Before you can start using the @mediahuis/chameleon-react component, you’ll need to install it, for more information check: Getting started for developers.

With that done, you’re now ready to implement the component in your application.

import { Hidden } from '@mediahuis/chameleon-react';

export default function Example() {
return <Hidden above="xs">Hidden above xs.</Hidden>;
}

Properties

PropertyTypeDefaultRequiredDescription
above'xs' | 'sm' | 'md' | 'lg'-NoDetermines the breakpoint above which the component will be hidden.
asElementType-NoAllows changing the rendered HTML element.
childrenReactNode-NoThe content of the component.
below'sm' | 'md' | 'lg' | 'xl'-NoDetermines the breakpoint below which the component will be hidden.
classNameString-NoAllows extending the class names of the component.
printBoolean-NoDetermines whether the component will be hidden on print.
screenBoolean-NoDetermines whether the component will be hidden on screen.