Map-Grid Embed
Embeddable VibeMap component that combines the map and grid views with a toggle button. Automatically fetches places and boundary data from the VibeMap API.
Usage
Basic Embed Code
<div id="vibemap-map-grid"></div>
<script
src="https://web.vibemap.com/load.js"
data-iframe-el="vibemap-map-grid"
data-resize="true"
data-url="https://web.vibemap.com/embed/map-grid?slug=san-francisco"
></script>
URL Parameters
Required Parameters
slug- Required. Boundary slug to fetch places for (e.g.,san-francisco,oakland,berkeley)- Automatically fetches boundary polygon and all places within the boundary
- Uses city name from boundary to load places from API
- Example:
slug=san-francisco
View Settings
initialView- Starting view:maporgrid(default:map)showTopLevelFilters- Show filters at top:trueorfalse(default:true)
Map Viewport (Optional - will use boundary defaults if not provided)
latorlatitude- Override center latitudelngorlongitude- Override center longitudezoom- Override zoom level 0-20bearing- Map rotation in degrees (default: 0)pitch- Map tilt in degrees (default: 0)
Filter Configuration
showFilters- Show filter section:trueorfalseshowVibeFilter- Show vibe filter:trueorfalseshowCategoryFilter- Show category filter:trueorfalseshowTagFilter- Show tag filter:trueorfalseshowSearchFilter- Show search box:trueorfalsefilterViewMode- Filter layout:horizontalortabbedfilterSelectionMode- Selection mode:single,multiple, orauto
Map Display
mapStyle- Map style:light,dark,streets, etc.showBoundary- Show boundary overlay:trueorfalseshowMarkers- Show map markers:trueorfalseshowHeat- Show heatmap layer:trueorfalseshowMapCards- Show card carousel on map (mobile):trueorfalse
Grid Display
gridColumns- Number of columns (default: 3)showDateRangeSelector- Show date filter:trueorfalseshownAtStart- Initial items to display (default: 100)
Card Display
cardStyle- Card layout:listorcarouselshowVibesOnCards- Show vibes on cards:trueorfalseshowTagsOnCards- Show tags on cards:trueorfalseshowAddressOnCards- Show address on cards:trueorfalseshowRating- Show ratings:trueorfalseshowBookmark- Show bookmark button:trueorfalsehideNoImageItems- Hide items that do not have an image:trueorfalsesubtitleSource- Subtitle content:category,address, etc.
Example with Parameters
<div id="vibemap-sf-events"></div>
<script
src="https://web.vibemap.com/load.js"
data-iframe-el="vibemap-sf-events"
data-resize="true"
data-url="https://web.vibemap.com/embed/map-grid?slug=san-francisco&initialView=grid&gridColumns=4&showDateRangeSelector=true&showVibesOnCards=true"
></script>
Data Fetching
The embed automatically:
- Fetches boundary data from
https://api.vibemap.com/v0.3/boundaries?slug={slug} - Extracts the city name and boundary polygon from the response
- Fetches all places from
https://api.vibemap.com/v0.3/places/?city={cityName}&filter_by_boundary=1 - Handles pagination automatically to load all available places
- Displays the boundary polygon on the map
- Centers the map on the boundary
PostMessage Events
The embed sends events to the parent window:
From Embed to Parent
view-changed- User toggled between map/gridfilters-changed- User changed filter selectionscard-clicked- User clicked a cardmarker-clicked- User clicked a map markerresize- Height changed (for iframe resizing)
From Parent to Embed
lightbox-state- Lock viewport during modal/lightbox
Development
Test locally:
# Basic test
http://localhost:3000/embed/map-grid?slug=san-francisco
# With options
http://localhost:3000/embed/map-grid?slug=oakland&initialView=grid&showVibesOnCards=true
# Test different cities
http://localhost:3000/embed/map-grid?slug=berkeley
http://localhost:3000/embed/map-grid?slug=austin
Note: Make sure the slug exists in the VibeMap API. You can check available boundaries at https://api.vibemap.com/v0.3/boundaries