{"id":25044962,"url":"https://github.com/sectorlabs/react-slim-media-query","last_synced_at":"2026-05-05T05:33:49.118Z","repository":{"id":44841765,"uuid":"171439928","full_name":"SectorLabs/react-slim-media-query","owner":"SectorLabs","description":"A really lightweight CSS media query component for React.","archived":false,"fork":false,"pushed_at":"2022-12-09T13:00:46.000Z","size":973,"stargazers_count":2,"open_issues_count":15,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-27T15:51:22.078Z","etag":null,"topics":["media-query","react","responsive"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/react-slim-media-query","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/SectorLabs.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-02-19T08:56:52.000Z","updated_at":"2021-02-16T09:29:02.000Z","dependencies_parsed_at":"2023-01-25T21:31:22.628Z","dependency_job_id":null,"html_url":"https://github.com/SectorLabs/react-slim-media-query","commit_stats":null,"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SectorLabs%2Freact-slim-media-query","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SectorLabs%2Freact-slim-media-query/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SectorLabs%2Freact-slim-media-query/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SectorLabs%2Freact-slim-media-query/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/SectorLabs","download_url":"https://codeload.github.com/SectorLabs/react-slim-media-query/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246395591,"owners_count":20770243,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["media-query","react","responsive"],"created_at":"2025-02-06T05:20:02.486Z","updated_at":"2026-05-05T05:33:49.089Z","avatar_url":"https://github.com/SectorLabs.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# react-slim-media-query\n\n[![MIT licensed](https://img.shields.io/badge/license-MIT-blue.svg)](https://raw.githubusercontent.com/hyperium/hyper/master/LICENSE)\n[![npm version](https://badge.fury.io/js/react-slim-media-query.svg)](https://badge.fury.io/js/react-slim-media-query)\n\nA really lightweight CSS media query component for React (1640B GZipped).\n\n\n## Usage\n\nMediaQuery is a wrapper component that will render its children if the provided media query will match.\nThere are 2 ways to specify the query:\n- Sending a `query` prop containg a CSS like media query.\n- Sending specific props like `minWidth`, `maxWidth` etc. These can be numbers or strings. The current supported features are:\n`minAspectRatio`, `maxAspectRatio`, `minDeviceAspectRatio`, `maxDeviceAspectRatio`, `minHeight`, `maxHeight`, `minDeviceHeight`,\n`maxDeviceHeight`, `minWidth`, `maxWidth`, `minDeviceWidth`, `maxDeviceWidth`, `minColor`, `maxColor`, `minColorIndex`, `maxColorIndex`,\n`minMonochrome`, `maxMonochrome`, `minResolution`, `maxResolution`.\n\n\n```jsx\nimport { MediaQuery } from 'react-slim-media-query';\n\nconst App = () =\u003e (\n    \u003cdiv\u003e\n        \u003cMediaQuery minWidth={1000}\u003e\n            \u003cdiv\u003eThe width should be 1000 or higher.\u003c/div\u003e\n        \u003c/MediaQuery\u003e\n        \u003cMediaQuery minWidth=\"1000px\"\u003e\n            \u003cdiv\u003eThe width should be 1000 or higher.\u003c/div\u003e\n        \u003c/MediaQuery\u003e\n        \u003cMediaQuery maxWidth={800}\u003e\n            \u003cdiv\u003eThe width should be 800 or less.\u003c/div\u003e\n        \u003c/MediaQuery\u003e\n        \u003cMediaQuery maxWidth=\"800px\"\u003e\n            \u003cdiv\u003eThe width should be 800 or less.\u003c/div\u003e\n        \u003c/MediaQuery\u003e\n        \u003cMediaQuery query=\"(max-device-width: 800px)\"\u003e\n            \u003cdiv\u003eThe width should be 800 or less.\u003c/div\u003e\n        \u003c/MediaQuery\u003e\n    \u003c/div\u003e\n);\n\n```\n\n## Server Side Rendering\n\nWhen rendered on server the query will always match. In order to override this behaviour you can set an initial state.\n\n\n```jsx\nimport { MediaQuery } from 'react-slim-media-query';\n\nconst App = () =\u003e (\n    \u003cdiv\u003e\n        \u003cMediaQuery minWidth={1000} initialState={{visible: true}}\u003e\n            \u003cdiv\u003eI should be visible when rendered on the server\u003c/div\u003e\n        \u003c/MediaQuery\u003e\n    \u003c/div\u003e\n);\n```\n\n\n\n\n\n\n\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsectorlabs%2Freact-slim-media-query","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsectorlabs%2Freact-slim-media-query","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsectorlabs%2Freact-slim-media-query/lists"}