Nano Stores Media Query

October 19, 2025 · View on GitHub

A smart store for Nano Stores state manager to sync with some media query.

  • Small. from 84 bytes (minified and brotlied). Zero dependencies. It uses Size Limit to control size.
  • It has good TypeScript.
  • Framework agnostic. It supports SSR.
import { fromMediaQuery } from '@nanostores/media-query'

export const $isMobile = fromMediaQuery('(max-width: 600px)')

Made at Evil Martians, product consulting for developer tools.


Install

npm install nanostores @nanostores/media-query

Usage

See Nano Stores docs about using the store and subscribing to store’s changes in UI frameworks.

You can degine store values:

export const $isMobile = fromMediaQuery('(max-width: 600px)', 'yes', 'no')