You are currently viewing outdated (<=3.x) Chameleon documentation on our old website. For version >=4.x, check out our new website.

Current release: 3.5.0 | hub

components

useMediaQuery (code)

Get responsive value for the active breakpoint.

MediaQuery: xs, redBase
import { useMediaQuery } from '@mediahuis/chameleon-react'

Breakpoints

xs: 0 and up - Mobile (portrait) | Grid Fluid

sm: 375px and up - Mobile (landscape) | Grid Fluid

md: 768px and up - Tablet (portrait) | Grid Fluid

lg: 1024px and up - Desktop (13inch) / Tablet (landscape) | Grid Fluid

xl: 1320px and up - HD Desktop (15inch and up) | Grid Static: 1200

Only use this in clientside applications!

Although this hook will use the fallback value in serverside context. It's recommended to use it only in clientside applications. Under the hood we use window.matchMedia.

Array

The default value will be used when window is not available.

MediaQuery: xs, redBase, dashed
import { useMediaQuery } from '@mediahuis/chameleon-react'

Object

MediaQuery: xs, redBase, dashed
import { useMediaQuery } from '@mediahuis/chameleon-react'

© Copyright 2020 Mediahuis NV. All rights Reserved