{"id":17881007,"url":"https://github.com/apaleslimghost/react-element-breakpoints","last_synced_at":"2026-04-16T19:08:11.262Z","repository":{"id":65372880,"uuid":"86461384","full_name":"apaleslimghost/react-element-breakpoints","owner":"apaleslimghost","description":"Element Queries in React, using the ResizeObserver polyfill.","archived":false,"fork":false,"pushed_at":"2017-03-28T13:38:00.000Z","size":7,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-01T10:47:43.564Z","etag":null,"topics":["css","element-queries","react","resize-observer","styled-components"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/apaleslimghost.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":"2017-03-28T13:08:32.000Z","updated_at":"2017-12-05T04:39:44.000Z","dependencies_parsed_at":"2023-01-19T23:35:19.456Z","dependency_job_id":null,"html_url":"https://github.com/apaleslimghost/react-element-breakpoints","commit_stats":null,"previous_names":["quarterto/react-element-breakpoints"],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/apaleslimghost%2Freact-element-breakpoints","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/apaleslimghost%2Freact-element-breakpoints/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/apaleslimghost%2Freact-element-breakpoints/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/apaleslimghost%2Freact-element-breakpoints/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/apaleslimghost","download_url":"https://codeload.github.com/apaleslimghost/react-element-breakpoints/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246797838,"owners_count":20835659,"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":["css","element-queries","react","resize-observer","styled-components"],"created_at":"2024-10-28T12:32:55.889Z","updated_at":"2026-04-16T19:08:06.239Z","avatar_url":"https://github.com/apaleslimghost.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"react-element-breakpoints\n===\n\nA higher-order-component for Element Queries in React, using the ResizeObserver polyfill.\n\nusage\n---\n\n```js\nimport {withBreakpoints, bp} from 'react-element-breakpoints';\n\nconst FancyHeader = withBreakpoints({\n\twide: ({width}) =\u003e width \u003e= 400,\n\ttall: ({height}) =\u003e height \u003e= 200,\n})(props =\u003e \u003ch1 style={{\n\tfontSize: bp('18px', {\n\t\twide: '30px'\n\t})(props),\n\n\tcolor: bp('black', {tall: 'red'})(props),\n}}\u003e\n\tIt works!\n\u003c/h1\u003e);\n```\n\nThe breakpoint functions are called with the `contentRect` from the ResizeObserver entry, which contains `left`, `top`, `right`, `bottom`, `width` and `height`.\n\n### with styled-components\n\nThe `bp` helper works well with styled-components:\n\n```js\nconst FancyHeader = withBreakpoints({\n\twide: ({width}) =\u003e width \u003e= 400,\n\ttall: ({height}) =\u003e height \u003e= 200,\n})(styled.h1`\n\tfont-size: ${bp('18px', {\n\t\twide: '30px'\n\t})},\n\n\tcolor: ${bp('black', {tall: 'red'})},\n`);\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fapaleslimghost%2Freact-element-breakpoints","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fapaleslimghost%2Freact-element-breakpoints","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fapaleslimghost%2Freact-element-breakpoints/lists"}