{"id":39741454,"url":"https://github.com/sarveshpro/mapbox-react-wrapper","last_synced_at":"2026-01-18T11:15:18.192Z","repository":{"id":61999879,"uuid":"556992146","full_name":"sarveshpro/mapbox-react-wrapper","owner":"sarveshpro","description":"Better React Wrapper for Mapbox GL","archived":false,"fork":false,"pushed_at":"2022-11-02T11:07:58.000Z","size":77,"stargazers_count":4,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-09-04T04:59:59.627Z","etag":null,"topics":["gis","map","mapbox","mapbox-gl","mapbox-gl-js","maps","react","typescript"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/mapbox-react-wrapper","language":"TypeScript","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/sarveshpro.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-10-24T22:32:07.000Z","updated_at":"2022-12-13T20:01:45.000Z","dependencies_parsed_at":"2023-01-21T04:19:52.249Z","dependency_job_id":null,"html_url":"https://github.com/sarveshpro/mapbox-react-wrapper","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"purl":"pkg:github/sarveshpro/mapbox-react-wrapper","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sarveshpro%2Fmapbox-react-wrapper","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sarveshpro%2Fmapbox-react-wrapper/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sarveshpro%2Fmapbox-react-wrapper/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sarveshpro%2Fmapbox-react-wrapper/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sarveshpro","download_url":"https://codeload.github.com/sarveshpro/mapbox-react-wrapper/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sarveshpro%2Fmapbox-react-wrapper/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28535160,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-18T10:13:46.436Z","status":"ssl_error","status_checked_at":"2026-01-18T10:13:11.045Z","response_time":98,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6: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":["gis","map","mapbox","mapbox-gl","mapbox-gl-js","maps","react","typescript"],"created_at":"2026-01-18T11:15:16.275Z","updated_at":"2026-01-18T11:15:18.185Z","avatar_url":"https://github.com/sarveshpro.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Better React Wrapper for Mapbox GL\n\n[![Node.js Package](https://github.com/sarveshpro/mapbox-react-wrapper/actions/workflows/npm-publish.yml/badge.svg)](https://github.com/sarveshpro/mapbox-react-wrapper/actions/workflows/npm-publish.yml)\n[![npm version](https://img.shields.io/npm/v/mapbox-react-wrapper.svg?style=flat)](https://www.npmjs.com/package/mapbox-react-wrapper)\n![npm bundle size](https://img.shields.io/bundlephobia/min/mapbox-react-wrapper)\n[![npm downloads](https://img.shields.io/npm/dm/mapbox-react-wrapper.svg)](https://www.npmjs.com/package/mapbox-react-wrapper)\n[![TypeScript](https://img.shields.io/badge/%3C%2F%3E-TypeScript-blue.svg)](https://github.com/microsoft/TypeScript)\n![npm peer dependency version](https://img.shields.io/npm/dependency-version/mapbox-react-wrapper/peer/mapbox-gl)\n![GitHub](https://img.shields.io/github/license/sarveshpro/mapbox-react-wrapper)\n\nThis is a React wrapper for Mapbox GL JS. I created this wrapper for 2 reasons:\n\n1. Existing wrappers are not well maintained and are not up to date with the latest Mapbox GL JS API.\n2. I wanted to support `mapbox-gl@v2` while still supporting `mapbox-gl@v1` because it's free.\n\n![video](https://user-images.githubusercontent.com/27153515/197651279-6230ee88-4cbf-490c-97e7-529eb603f362.gif)\n\n## Installation\n\n```bash\nnpm install mapbox-react-wrapper\n```\n\nBy default, this package will install `mapbox-gl@v1`. If you want to use `mapbox-gl@v2`, you can install it like this:\n\n```bash\nnpm install mapbox-react-wrapper mapbox-gl@2.10.0\n```\n\n## Usage\n\n```jsx\nimport React from \"react\";\nimport { MapboxReact } from \"mapbox-react-wrapper\";\n\nconst App = () =\u003e {\n  return (\n    \u003cMapboxReact\n      accessToken={\"YOUR_ACCESS_TOKEN\"} // not required if you are on mapbox-gl@v1 and aren't using mapbox's map styles\n      mapStyle=\"mapbox://styles/mapbox/streets-v11\" // url or mapbox style object\n      mapboxOptions={{\n        center: [0, 0],\n        zoom: 1.5,\n      }}\n    /\u003e\n  );\n};\n\nexport default App;\n```\n\n## Props\n\n| Prop            | Type                    | Description                                                         |\n| --------------- | ----------------------- | ------------------------------------------------------------------- |\n| accessToken     | string                  | Mapbox access token. Required if you are using mapbox's map styles. |\n| mapStyle        | string or object        | Mapbox style object or url.                                         |\n| interactive     | boolean                 | Whether the map is interactive.                                     |\n| height          | CSSProperties['height'] | Height of the map.                                                  |\n| width           | CSSProperties['height'] | Width of the map.                                                   |\n| mapboxOptions   | MapboxOptions           | Mapbox options.                                                     |\n| idleSpin        | boolean                 | Whether the map should spin when idle.                              |\n| showMapControls | boolean                 | Whether to show map controls.                                       |\n| markers         | CustomMarkerProps[]     | Array of markers.                                                   |\n| flyTo           | CustomFlyToOptions      | Fly to options.                                                     |\n\n## Props supported in `mapbox-gl@v2`\n\n| Prop       | Type           | Description                 |\n| ---------- | -------------- | --------------------------- |\n| projection | ProjectionLike | Projection used by the map. |\n| fog        | FogOptions     | Fog options.                |\n\n## Examples\n\n### 3D Globe Projection\n\nWorks with `mapbox-gl@v2`\n\n```jsx\nimport React from \"react\";\nimport { MapboxReact } from \"mapbox-react-wrapper\";\n\nconst App = () =\u003e {\n  return (\n    \u003cMapboxReact\n      accessToken={\"YOUR_ACCESS_TOKEN\"} // not required if you are on mapbox-gl@v1 and aren't using mapbox's map styles\n      mapStyle=\"mapbox://styles/mapbox/streets-v11\" // url or mapbox style object\n      mapboxOptions={{\n        center: [0, 0],\n        zoom: 1.5,\n        projection: {\n          name: \"globe\",\n        },\n      }}\n      fog={{\n        range: [-1, 2],\n        \"horizon-blend\": 0.3,\n        color: \"#242B4B\",\n        \"high-color\": \"#161B36\",\n        \"space-color\": \"#0B1026\",\n        \"star-intensity\": 0.8,\n      }}\n    /\u003e\n  );\n};\n\nexport default App;\n```\n\n### Free Mapbox GL JS\n\nUsing open satellite layer from arcgis instead of mapbox map styles and `mapbox-gl@v1` where you don't need an access token if no mapbox APIs are being used. You can also use map style objects which follow [Mapbox Style Spec](https://docs.mapbox.com/mapbox-gl-js/style-spec/). [OpenMapTiles](https://openmaptiles.org/styles/) is a collection of Open-source map styles that follow Mapbox GL style specification. It requires a little bit of tweeking but it works. Maybe I can include support for other map styles in future versions. Best part is with `mapbox-gl@v1` you can use it for free. Don't forget to add proper attribution when using third party map styles.\n\n```jsx\nimport React from \"react\";\nimport { MapboxReact } from \"mapbox-react-wrapper\";\n\nconst App = () =\u003e {\n  return (\n    \u003cMapboxReact\n      mapboxOptions={{\n        center: [0, 0],\n        zoom: 1.5,\n      }}\n      // arcgis satellite layer\n      rasterSourceLayers={[\n        {\n          source: {\n            id: \"satellite-source\",\n            type: \"raster\",\n            tiles: [\n              \"https://wayback.maptiles.arcgis.com/arcgis/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}\",\n            ],\n            tileSize: 256,\n          },\n          layers: [\n            {\n              id: \"raster-layer\",\n              type: \"raster\",\n              source: \"satellite-source\",\n              minzoom: 0,\n              maxzoom: 22,\n            },\n          ],\n        },\n      ]}\n    /\u003e\n  );\n};\n\nexport default App;\n```\n\n## Roadmap till v0.1.0\n\n- [x] globe projection with `mapbox-gl@v2`\n- [x] free usage with `mapbox-gl@v1`\n- [x] custom map styles\n- [x] default markers\n- [x] partial support for raster layers\n- [x] fly to options\n- [x] idle spin\n- [x] fog support with `mapbox-gl@v2`\n- [ ] custom markers and popups\n- [ ] geojson layers\n- [ ] raster layers\n- [ ] vector layers\n- [ ] events\n- [ ] clustering\n\n## Contributing\n\nContributions are welcome! Please open an issue or a PR.\n\n## License\n\n[MIT](https://github.com/sarveshpro/mapbox-react-wrapper/blob/main/LICENSE)\n\n## :heart: of Open Source\n\nThis project is part of the [Open Source Initiative](https://opensource.org/osd).\n\n[![Open Source](https://badges.frapsoft.com/os/v1/open-source.svg?v=103)](https://opensource.org/)\n\n## Disclaimer\n\nThis project is not affiliated with Mapbox in any way. Mapbox is a registered trademark of [Mapbox, Inc.](https://www.mapbox.com/). I am using Mapbox's APIs and services in the spirit of Open Source. Any issues with the usage of Mapbox's APIs and services should be directed to [Mapbox, Inc.](https://www.mapbox.com/).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsarveshpro%2Fmapbox-react-wrapper","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsarveshpro%2Fmapbox-react-wrapper","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsarveshpro%2Fmapbox-react-wrapper/lists"}