This library is still in development and is available only for internal usage at VTEX.
Skip to main content

Developing

Hooks

Version: 0.136.0

Hooks

useMediaQuery

This is a CSS media query hook for React. It listens for matches to a CSS media query. It allows the rendering of components based on whether the query matches or not.

import { useMediaQuery } from '@vtex/admin-ui'

Usage

Loading...
Loading...

Parameter

typerequireddescription
string, string[]A unique media query or an array of queries

Return Value

The useMediaQuery hook returns an array of booleans, indicating whether the given query matches or queries match.

typedescription
boolean[]An array of matches for each query passed