Hidden
Installation
yarn add @spark-web/hidden
Conditionally display content for different screen sizes and media types.
Examples
Responsive
Hide content responsively using the above
and below
props, which accept a
breakpoint name.
Conditionally display content for print using the on
prop.
Props
Prop | Type | Description |
---|---|---|
children | ReactNode: string | number | false | true | {} | ReactElement<any, string | JSXElementConstructor<any>> | Iterable<ReactNode> | ReactPortal | Children elements to be conditionally rendered. |
above? | "mobile" | "tablet" | "desktop" | Sets the screen width floor breakpoint the elements should be hidden. |
below? | "tablet" | "desktop" | "wide" | Sets the screen width ceiling breakpoint the elements should be hidden. |
data? | DataAttributeMap | Sets data attributes for the element. |
inline? | boolean | Sets whether element should be rendered in-line or on a new line. |
on? | "screen" | "print" | Sets on what type of device element should be hidden. @see https://developer.mozilla.org/en-US/docs/Web/CSS/@media#media_types |