1.0.1 โ€ข Published 11 months ago

react-google-map-location v1.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
11 months ago

๐ŸŒ react-google-map-location

YouTube Grid Extension License

A lightweight and fully responsive React component for embedding Google Maps based on a location string or coordinates. No API key required!


๐Ÿš€ Features

  • ๐Ÿ‹๏ธโ€โ™€๏ธ Lightweight: No need to worry about large bundle sizes.
  • ๐Ÿ”‘ No API Key Required: Easily embed maps without any additional setup.
  • ๐Ÿ“ฑ Responsive Design: Perfectly adapts to both mobile and desktop layouts.
  • ๐ŸŒ Supports Address and Coordinates: Pass either a location string or latitude/longitude values.
  • โš™๏ธ Custom Error Handling: Easily provide custom error components.

Examle

๐Ÿ“ฆ Installation

npm install react-google-map-location

๐Ÿ“– Usage

import React from 'react';
import { MapLocation } from 'react-google-map-location';

const App = () => {
  return (
      <MapLocation
        location="Sveavรคgen 53, 4 tr, 101 24 Stockholm, Sweden" 
        zoom={12} 
        height='333px'
        mapType="satellite" 
        loading="lazy" 
        style={{ borderRadius: '8px' }} 
      />

      <MapLocation
        location={{ lat: 59.340140, lng: 18.058610 }} 
        height='500px'
        zoom={14}
      />

      <MapLocation
        height='500px'
      />
  )
}

export default App;

๐ŸŽ›๏ธ Props

PropTypeDefaultDescription
locationstring \| { lat: number; lng: number }undefinedThe location as a string (e.g., "Sveavรคgen 53, 4 tr, 101 24 Stockholm, Sweden") or a coordinates object { lat, lng }. When not provided, the map shows a default global view.
widthstring \| number'100%'The width of the map container.
heightstring \| number'100%'The height of the map container.
zoomnumber16The zoom level of the map.
mapType'roadmap' \| 'satellite''roadmap'The map type: either roadmap or satellite.
loading'lazy' \| 'eager''lazy'Controls the loading behavior of the iframe: lazy (on scroll) or eager.
styleReact.CSSProperties{}Additional inline styles for the iframe.

๐Ÿ›ก๏ธ Advantages

  • ๐Ÿ‹๏ธโ€โ™€๏ธ Lightweight: This package is designed to have a minimal footprint, ensuring a fast loading time and efficient performance.
  • ๐Ÿ”‘ No API Key Required: Easily embed Google Maps without the need for an API key, making integration straightforward and hassle-free.
  • ๐Ÿ“ฑ Responsive Design: The map component automatically adapts to various screen sizes, ensuring a seamless experience on both mobile and desktop devices.
  • ๐ŸŒ Supports Address and Coordinates: You can provide either a location string (e.g., "Sveavรคgen 53, 4 tr, 101 24 Stockholm, Sweden") or specific latitude and longitude coordinates to display the map.
  • โš™๏ธ Custom Error Handling: You can specify a custom error component to be displayed if the location provided is invalid, or fall back to a default message.

โญ Support

If you find this extension useful, consider giving it a star on GitHub!
โญ Star on GitHub


๐Ÿ“„ License

This project is licensed under the MIT License - see the LICENSE.md file for details.# react-google-map-location

1.0.1

11 months ago

1.0.0

11 months ago