![require(esm) Backported to Node.js 20, Paving the Way for ESM-Only Packages](https://cdn.sanity.io/images/cgdhsj6q/production/be8ab80c8efa5907bc341c6fefe9aa20d239d890-1600x1097.png?w=400&fit=max&auto=format)
Security News
require(esm) Backported to Node.js 20, Paving the Way for ESM-Only Packages
require(esm) backported to Node.js 20, easing the transition to ESM-only packages and reducing complexity for developers as Node 18 nears end-of-life.
@s-ui/sui-map-google
Advanced tools
Simple bindings to the Google Maps API using React. Most of the components provided by this library are wrappers of [react-google-maps-api](https://github.com/JustFly1984/react-google-maps-api)
Simple bindings to the Google Maps API using React. Most of the components provided by this library are wrappers of react-google-maps-api
$ npm install @s-ui/sui-map-google
Render a map. Toggle between a static map image and a dynamic map using isInteractive
prop. The dynamic map is a wrapper of GoogleMap but also loads Google Maps script out of the box. Use loaderNode
and errorNode
to optionally display loading and error states. All the props defined in the wrapped component are also available.
import MapGoogle from '@s-ui/sui-map-google'
const MapGoogleExample = () => {
return <MapGoogle apiKey="AIzaSyDp7wqS1IyRZCvMMsY2LX2V1TXY4Lh8UGA" />
}
Render a set of add-ons on the dynamic map setting the following components as children of MapGoogle
.
import MapGoogle from '@s-ui/sui-map-google'
import MapGoogleMarker from '@s-ui/sui-map-google/lib/marker/index.js'
const MapGoogleAddOnsExample = () => {
return (
<MapGoogle apiKey="AIzaSyDp7wqS1IyRZCvMMsY2LX2V1TXY4Lh8UGA">
<MapGoogleMarker position={{lat: 40.714728, lng: -73.998672}} />
</MapGoogle>
)
}
Render a static map image. Similar to MapGoogle
it requires the apiKey
prop. The rest of the props are the parameters defined in the Maps Static API documentation (e.g. center
and zoom
).
It is recommended, depending on your usage of this static map, a digital signature - in addition to an API key - to authenticate requests. So, if you need to use a signed url, you can use signedUrl
prop. This prop has priority over the rest of the props that generate the url when you don't need a signature. Pay attention to the digital signature documentation to see how to create this url in your web app.
import MapGoogleImage from '@s-ui/sui-map-google/lib/image/index.js'
const MapGoogleImageExample = () => {
return (
<MapGoogleImage
apiKey="AIzaSyDp7wqS1IyRZCvMMsY2LX2V1TXY4Lh8UGA"
center="40.714728,-73.998672"
zoom="12"
size="600x600"
alt="Mapa"
width="600"
height="600"
/>
)
}
Utility component to freehand draw on map, as child of MapGoogle
.
import MapGoogle from '@s-ui/sui-map-google'
import MapGoogleDrawer from '@s-ui/sui-map-google/lib/drawer/index.js'
const polylineStyles = {
strokeColor: '#2b91c1',
strokeOpacity: 0.5,
strokeWeight: 4
}
const MapGoogleAddOnsExample = () => {
const handleStopDrawing = ({path}) => console.log(path)
return (
<MapGoogle apiKey="AIzaSyDp7wqS1IyRZCvMMsY2LX2V1TXY4Lh8UGA">
<MapGoogleDrawer
drawing
onStopDrawing={handleStopDrawing}
polylineOptions={polylineStyles}
/>
</MapGoogle>
)
}
@import '~@s-ui/theme/lib/index';
/* @import 'your theme'; */
@import '~@s-ui/sui-map-google/lib/index';
Find full description and more examples in the demo page.
FAQs
Simple bindings to the Google Maps API using React. Most of the components provided by this library are wrappers of [react-google-maps-api](https://github.com/JustFly1984/react-google-maps-api)
The npm package @s-ui/sui-map-google receives a total of 1,638 weekly downloads. As such, @s-ui/sui-map-google popularity was classified as popular.
We found that @s-ui/sui-map-google demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
require(esm) backported to Node.js 20, easing the transition to ESM-only packages and reducing complexity for developers as Node 18 nears end-of-life.
Security News
PyPI now supports iOS and Android wheels, making it easier for Python developers to distribute mobile packages.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.