Skip to content

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

License

Notifications You must be signed in to change notification settings

nanostores/media-query

Repository files navigation

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

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

About

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

Resources

License

Stars

Watchers

Forks

Sponsor this project