Skip to content

Latest commit

 

History

History
43 lines (28 loc) · 1.29 KB

File metadata and controls

43 lines (28 loc) · 1.29 KB

Nano Stores Media Query

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)')

  Nano Stores Media Query is built by Evil Martians, an American design and engineering consultancy for developer tools, AI, and cybersecurity startups.


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')