Skip to content
On this page

useMedia

Hook using media queries.

Code demonstration

API

const value = useMedia(['(min-width: 320px)'], [true], false)
const value = useMedia(['(min-width: 320px)'], [true], false)

Options

PropertyDescriptionTypeDefault
queriesMedia to query for an array of objectsstring[]-
valuesThe default value for each media query objectboolean[]-
defaultValueDefaultValueboolean

Result

PropertyDescriptionType
valueCompliance with the queryReadonly<Ref<boolean>>

Source

SourceDocsDemo