{"id":30378435,"url":"https://github.com/hadiab/styled-easy-mq","last_synced_at":"2026-05-15T13:35:29.259Z","repository":{"id":57373322,"uuid":"383508780","full_name":"hadiab/styled-easy-mq","owner":"hadiab","description":"Easy media query in 'backticks'","archived":false,"fork":false,"pushed_at":"2021-07-11T06:44:27.000Z","size":14304,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-09-24T09:47:48.850Z","etag":null,"topics":["emotion","media-queries","mq","styled","styled-components"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hadiab.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-07-06T15:05:12.000Z","updated_at":"2021-07-08T14:28:09.000Z","dependencies_parsed_at":"2022-08-30T00:40:59.238Z","dependency_job_id":null,"html_url":"https://github.com/hadiab/styled-easy-mq","commit_stats":null,"previous_names":["hadiab/css-in-js-mq-helper"],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/hadiab/styled-easy-mq","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hadiab%2Fstyled-easy-mq","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hadiab%2Fstyled-easy-mq/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hadiab%2Fstyled-easy-mq/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hadiab%2Fstyled-easy-mq/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hadiab","download_url":"https://codeload.github.com/hadiab/styled-easy-mq/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hadiab%2Fstyled-easy-mq/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33068703,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-15T11:35:32.926Z","status":"ssl_error","status_checked_at":"2026-05-15T11:35:31.362Z","response_time":103,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["emotion","media-queries","mq","styled","styled-components"],"created_at":"2025-08-20T18:34:23.052Z","updated_at":"2026-05-15T13:35:29.244Z","avatar_url":"https://github.com/hadiab.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Styled Easy MQ\n\nEasy media query in `backticks`\n\n\n[![npm version](https://img.shields.io/npm/v/styled-easy-mq.svg)](https://www.npmjs.com/package/styled-easy-mq)\n\n## Install\n\n```\nnpm install styled-easy-mq\n```\n**or**\n\n```\nyarn add styled-easy-mq\n```\n\n## Usage\n\nCreate a media query function, By default the breakpoints are [576, 768, 992, 1200]\n\n```ts\nimport { createMediaQuery } from 'styled-easy-mq';\n\nconst mq = createMediaQuery()\n```\n\nYou can pass your own breakpoints\n\n```ts\nconst br = [500, 700, 900, 1100] // or [\"20em\", \"30em\", \"50em\", \"70em\"]\n\nconst mq = createMediaQuery(br)\n```\n\n### Use media query\n\nPassing an array with values for each breakpoint (mobile first)\n\n```tsx\nmq`\n\twidth: ${[300, 600, 900]};\n\tcolor: ${[\"red\", \"blue\"]};\n\tbackground-color: white;\n`\n```\n\nI'm using facepaint to generate media query for each property that have an array value,\nthe first value is considered a default value and is not a child of a media query,\nlearn more about [facepaint](https://github.com/emotion-js/facepaint)\n\n## Example\n\nWith emotion (also work with styled-components)\n\n```tsx\nimport { createMediaQuery } from \"styled-easy-mq\"\nimport { css } from \"emotion\"\n\nconst mq = createMediaQuery()\n\nconst style = mq`\n\tdisplay: flex;\n\tflex-direction: ${[\"column\", \"row\"]};\n\tpadding: ${[10, 20, 30, 40]};\n`\n\n\u003cdiv className={css(style)}\u003eExample\u003c/div\u003e\n```\n\n## Create Css function\n\nYou can create your own css function, so you don't need to wrap every style with css\n\n```tsx\nimport { createCss } from \"styled-easy-mq\"\nimport { css as emotion } from \"emotion\"\n\nconst css = createCss(emotion)\n\nconst className = css`\n\tdisplay: flex;\n\tflex-direction: ${[\"row\", \"column\"]};\n\tmargin: ${[10, 30]};\n`\n\n\u003cdiv className={className}\u003eCSS\u003c/div\u003e\n```\n\n## API\n\n#### createMediaQuery `function`\n\n```ts\ncreateMediaQuery = (breakpoints?: number[]) =\u003e (style: StyleObject) =\u003e DynamicStyle[]\n```\n\n#### createCss `function`\n\n```ts\ncreateCss = (css: (...args: any[]) =\u003e string, breakpoints?: number[]) =\u003e (style: TemplateStringsArray) =\u003e string\n```\n\n### You can also use it as an object\n\n```tsx\nmq({\n\twidth: [300, 600, 900];\n\tcolor: [\"red\", \"blue\"];\n\tbackgroundColor: \"white\"\n})\n```\n\nit's the default way of how facepaint work, this library was intended to make the using of media query in string much easier, so if you only will use the object syntax you don't need this library, facepaint is enough\n\n## Syntax Highlighting\n\nIf you didn't get any syntax highlighting that's because styled-components plugin support these alises (styled, css)\n\n* One option is to change the var name from mq to styled, css or even xstyled\n* Another option is to use es6-string-css it's VS Code plugin, [learn more](https://marketplace.visualstudio.com/items?itemName=bashmish.es6-string-css)\n\n## Contributing\n\nPlease read [CONTRIBUTING.md](https://gist.github.com/PurpleBooth/b24679402957c63ec426) for details on our code of conduct, and the process for submitting pull requests to us.\n\n## Versioning\n\nWe use [SemVer](http://semver.org/) for versioning. For the versions available, see the [tags on this repository](https://github.com/your/project/tags).\n\n## Authors\n\n* **Abdalhadi Abdallah** - *Initial work* - [hadiab](https://github.com/hadiab)\n\nSee also the list of [contributors](https://github.com/your/project/contributors) who participated in this project.\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE.md](LICENSE.md) file for details","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhadiab%2Fstyled-easy-mq","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhadiab%2Fstyled-easy-mq","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhadiab%2Fstyled-easy-mq/lists"}