Tailwind CSS Maps
Build interactive maps with Leaflet! Add features like stonescale styles, custom pins, and city switching for seamless, mobile-friendly map experiences.
Requires Additional Installation
Note that this component requires the use of the third-party Leaflet plugin.
Installation
-
Install Leaflet
Install
leafletvia npmTerminalnpm i leaflet -
Add the Leaflet CSS
Include the CSS
<script>near the end of your</head>tag:HTML -
Add the Leaflet JavaScript
Include the JavaScript
<script>near the end of your</head>tag:HTML
Default map
Start with a basic Leaflet map using OpenStreetMap tiles and bounded panning.
Map with marker
Add a default Leaflet marker with a popup anchored to a specific location.
Grayscale basemap
Swap in a muted light basemap when you want the marker and overlays to stand out more clearly.
Custom map marker
Replace the default pin with a custom SVG marker while keeping the same popup behavior.
Custom marker popovers
Bind richer popup content to multiple markers to show location-specific metrics.
City switcher
Recenter the map from tab controls so users can jump between predefined cities.
Bubble map
Visualize location-based metrics with animated circle overlays that scale by value.