Open Street Map
Basic map
<div class="c-openstreetmap c-openstreetmap--size-sm" data-js-map-pin-data="[{"lat":"56.036647","lng":"12.713098"},{"lat":"56.046029","lng":"12.693904"}]" data-js-map-start-position="{"lat":"56.046029","lng":"12.693904","zoom":14}" data-js-map-style="default" data-js-toggle-item="expand" data-js-toggle-class="is-expanded" data-js-map-id="66288b56acd97" data-observe-resizes="" id="66288b56acd97" data-uid="66288b56acd97">
<div class="c-openstreetmap__map" style="height:60vh;" id="openstreetmap__map-66288b56acd97" tabindex="0">
</div>
<template class="c-openstreetmap__pin-icon">
<!-- icon.blade.php -->
<span class="c-icon c-openstreetmap__marker c-icon--{icon-name} c-icon--material c-icon--material-{ICON_NAME} material-symbols-outlined material-symbols-outlined--filled c-icon--color-white c-icon--size-md" style="background-color:{ICON_BACKGROUND_COLOR}; font-size:20px;" material-symbol="{ICON_NAME}" role="img" aria-label="Icon: Undefined" alt="Icon: Undefined" data-nosnippet="" translate="no" aria-hidden="true" data-uid="66288b56adc90">
</span>
</template>
<template class="c-openstreetmap__pin-tooltip">
<div class="c-openstreetmap__tooltip">
<a class="c-link c-openstreetmap__tooltip-link" id="" rel="nofollow" href="{TOOLTIP_LINK}" target="_top" data-uid="66288b56ae310">
<!-- typography.blade.php original: h2 -->
<h2 class="c-typography c-openstreetmap__tooltip-title c-typography__variant--h5" data-uid="66288b56ae29e">
{TOOLTIP_HEADING}
</h2>
</a>
<!-- typography.blade.php original: p -->
<p class="c-typography u-margin__y--1 c-openstreetmap__tooltip-excerpt c-typography__variant--p" data-uid="66288b56ae35a">
{TOOLTIP_EXCERPT}
</p> <!-- image.blade.php -->
<figure class="c-image c-openstreetmap__tooltip-image u-margin__top--1" rel="nofollow" data-uid="66288b56ae3c1">
<img src="{TOOLTIP_IMAGE_SRC}" alt="{TOOLTIP_IMAGE_ALT}" class="c-image__image" />
</figure>
<a class="c-link c-openstreetmap__tooltip-directions" id="" rel="nofollow" href="{TOOLTIP_DIRECTIONS_URL}" target="_top" data-uid="66288b56ae3fc">
{TOOLTIP_DIRECTIONS_LABEL}
</a>
</div>
</template></div>
@openStreetMap([
'pins' => [
[
'lat' => '56.036647',
'lng' => '12.713098',
],
[
'lat' => '56.046029',
'lng' => '12.693904',
]
],
'startPosition' => ['lat' => '56.046029', 'lng' => '12.693904', 'zoom' => 14],
'height' => '60vh',
'containerAware' => true,
'mapStyle' => 'default'
])
@endopenStreetMap
Better tooltips
<div class="c-openstreetmap c-openstreetmap--size-sm" data-js-map-pin-data="[{"lat":"56.036647","lng":"12.713098","tooltip":{"title":"Marker 1 clickable","excerpt":"This is an excerpt.","image":{"src":"https:\/\/images.unsplash.com\/photo-1503023345310-bd7c1de61c7d?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&w=1000&q=80","alt":"The alt text"},"directions":{"label":"The directions label","url":"#directionsUrl"}}},{"lat":"56.046029","lng":"12.693904","tooltip":{"title":"Marker 2 clickable","excerpt":"This is an excerpt.","image":{"src":"https:\/\/images.unsplash.com\/photo-1503023345310-bd7c1de61c7d?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&w=1000&q=80","alt":"The alt text"},"directions":{"label":"The directions label","url":"#directionsUrl"}}}]" data-js-map-start-position="{"lat":"56.046029","lng":"12.693904","zoom":14}" data-js-map-style="dark" data-js-toggle-item="expand" data-js-toggle-class="is-expanded" data-js-map-id="66288b56ae904" data-observe-resizes="" id="66288b56ae904" data-uid="66288b56ae904">
<div class="c-openstreetmap__map" style="height:60vh;" id="openstreetmap__map-66288b56ae904" tabindex="0">
</div>
<template class="c-openstreetmap__pin-icon">
<!-- icon.blade.php -->
<span class="c-icon c-openstreetmap__marker c-icon--{icon-name} c-icon--material c-icon--material-{ICON_NAME} material-symbols-outlined material-symbols-outlined--filled c-icon--color-white c-icon--size-md" style="background-color:{ICON_BACKGROUND_COLOR}; font-size:20px;" material-symbol="{ICON_NAME}" role="img" aria-label="Icon: Undefined" alt="Icon: Undefined" data-nosnippet="" translate="no" aria-hidden="true" data-uid="66288b56aea42">
</span>
</template>
<template class="c-openstreetmap__pin-tooltip">
<div class="c-openstreetmap__tooltip">
<a class="c-link c-openstreetmap__tooltip-link" id="" rel="nofollow" href="{TOOLTIP_LINK}" target="_top" data-uid="66288b56aeb19">
<!-- typography.blade.php original: h2 -->
<h2 class="c-typography c-openstreetmap__tooltip-title c-typography__variant--h5" data-uid="66288b56aeadf">
{TOOLTIP_HEADING}
</h2>
</a>
<!-- typography.blade.php original: p -->
<p class="c-typography u-margin__y--1 c-openstreetmap__tooltip-excerpt c-typography__variant--p" data-uid="66288b56aeb4f">
{TOOLTIP_EXCERPT}
</p> <!-- image.blade.php -->
<figure class="c-image c-openstreetmap__tooltip-image u-margin__top--1" rel="nofollow" data-uid="66288b56aebf8">
<img src="{TOOLTIP_IMAGE_SRC}" alt="{TOOLTIP_IMAGE_ALT}" class="c-image__image" />
</figure>
<a class="c-link c-openstreetmap__tooltip-directions" id="" rel="nofollow" href="{TOOLTIP_DIRECTIONS_URL}" target="_top" data-uid="66288b56aec41">
{TOOLTIP_DIRECTIONS_LABEL}
</a>
</div>
</template></div>
@openStreetMap([
'pins' => [
[
'lat' => '56.036647',
'lng' => '12.713098',
'tooltip' => [
'title' => 'Marker 1 clickable',
'excerpt' => 'This is an excerpt.',
'image' => [
'src' => 'https://images.unsplash.com/photo-1503023345310-bd7c1de61c7d?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&w=1000&q=80',
'alt' => 'The alt text'
],
'directions' => [
'label' => 'The directions label',
'url' => '#directionsUrl'
]
],
],
[
'lat' => '56.046029',
'lng' => '12.693904',
'tooltip' => [
'title' => 'Marker 2 clickable',
'excerpt' => 'This is an excerpt.',
'image' => [
'src' => 'https://images.unsplash.com/photo-1503023345310-bd7c1de61c7d?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&w=1000&q=80',
'alt' => 'The alt text'
],
'directions' => [
'label' => 'The directions label',
'url' => '#directionsUrl'
]
],
]
],
'startPosition' => ['lat' => '56.046029', 'lng' => '12.693904', 'zoom' => 14],
'height' => '60vh',
'containerAware' => true,
'mapStyle' => 'dark'
])
@endopenStreetMap
Using sidebar
<div class="c-openstreetmap c-openstreetmap--size-sm c-openstreetmap--sidebar" data-js-map-start-position="{"lat":"56.046029","lng":"12.693904","zoom":14}" data-js-map-style="pale" data-js-toggle-item="expand" data-js-toggle-class="is-expanded" data-js-map-id="66288b56af4c9" data-observe-resizes="" id="66288b56af4c9" data-uid="66288b56af4c9">
<div class="c-openstreetmap__map" style="height:100vh;" id="openstreetmap__map-66288b56af4c9" tabindex="0">
<!-- icon.blade.php -->
<span class="c-icon c-openstreetmap__expand-icon u-level-1 c-icon--map c-icon--material c-icon--material-map material-symbols-outlined material-symbols-outlined--filled c-icon--size-lg" data-js-toggle-trigger="expand" material-symbol="map" role="img" aria-label="Icon: Undefined" alt="Icon: Undefined" data-nosnippet="" translate="no" aria-hidden="true" data-uid="66288b56af556">
</span>
</div>
<div class="c-openstreetmap__sidebar" data-observe-resizes>
<div class="c-openstreetmap__container" data-js-pagination-target>
<div class="c-openstreetmap__inner-blocks u-hide-empty"><InnerBlocks /></div>
<!-- typography.blade.php original: h2 -->
<h2 class="c-typography u-margin__top--0 u-margin__bottom--4 c-typography__variant--h2" data-uid="66288b56af2b8">
Info
</h2> <!-- card.blade.php -->
<div class="c-card u-padding--2 u-margin__bottom--2 c-card--default c-card--image-first c-card--ratio-4-3" data-js-map-location="{"lat":"56.032075356631","lng":"12.70340666113"}" data-uid="66288b56af3b2">
<!-- typography.blade.php original: h3 -->
<h3 class="c-typography c-typography__variant--h3" data-uid="66288b56af300">
#Read me
</h3> <!-- typography.blade.php original: p -->
<p class="c-typography c-typography__variant--p" data-uid="66288b56af334">
This element contains an attribute that automatically creates a pin and adds it to the map.
</p>
</div>
<!-- card.blade.php -->
<div class="c-card u-padding--2 c-card--default c-card--image-first c-card--ratio-4-3" data-js-map-location="{"lat":"56.052075356631","lng":"12.70340666113","tooltip":{"title":"Tooltip title","excerpt":"Tooltip excerpt","directions":{"label":"Directions label","url":"https:\/\/www.google.com\/maps\/dir\/?api=1&destination=56.052075356631,12.70340666113&travelmode=transit"}}}" data-uid="66288b56af47b">
<!-- typography.blade.php original: h3 -->
<h3 class="c-typography c-typography__variant--h3" data-uid="66288b56af409">
#Click me
</h3> <!-- typography.blade.php original: p -->
<p class="c-typography c-typography__variant--p" data-uid="66288b56af446">
A tooltip can also be added which has the same structure as a "pin" in the "pins" array. This tooltip will open when clicking on the connected element in the sidebar.
</p>
</div>
</div>
</div> <template class="c-openstreetmap__pin-icon">
<!-- icon.blade.php -->
<span class="c-icon c-openstreetmap__marker c-icon--{icon-name} c-icon--material c-icon--material-{ICON_NAME} material-symbols-outlined material-symbols-outlined--filled c-icon--color-white c-icon--size-md" style="background-color:{ICON_BACKGROUND_COLOR}; font-size:20px;" material-symbol="{ICON_NAME}" role="img" aria-label="Icon: Undefined" alt="Icon: Undefined" data-nosnippet="" translate="no" aria-hidden="true" data-uid="66288b56afad0">
</span>
</template>
<template class="c-openstreetmap__pin-tooltip">
<div class="c-openstreetmap__tooltip">
<a class="c-link c-openstreetmap__tooltip-link" id="" rel="nofollow" href="{TOOLTIP_LINK}" target="_top" data-uid="66288b56afb9d">
<!-- typography.blade.php original: h2 -->
<h2 class="c-typography c-openstreetmap__tooltip-title c-typography__variant--h5" data-uid="66288b56afb65">
{TOOLTIP_HEADING}
</h2>
</a>
<!-- typography.blade.php original: p -->
<p class="c-typography u-margin__y--1 c-openstreetmap__tooltip-excerpt c-typography__variant--p" data-uid="66288b56afbd3">
{TOOLTIP_EXCERPT}
</p> <!-- image.blade.php -->
<figure class="c-image c-openstreetmap__tooltip-image u-margin__top--1" rel="nofollow" data-uid="66288b56afc24">
<img src="{TOOLTIP_IMAGE_SRC}" alt="{TOOLTIP_IMAGE_ALT}" class="c-image__image" />
</figure>
<a class="c-link c-openstreetmap__tooltip-directions" id="" rel="nofollow" href="{TOOLTIP_DIRECTIONS_URL}" target="_top" data-uid="66288b56afc5d">
{TOOLTIP_DIRECTIONS_LABEL}
</a>
</div>
</template></div>
@openStreetMap([
'startPosition' => ['lat' => '56.046029', 'lng' => '12.693904', 'zoom' => 14],
'height' => '100vh',
'containerAware' => true,
'mapStyle' => 'pale'
])
@slot('sidebarContent')
@typography([
'element' => 'h2',
'classList' => ['u-margin__top--0', 'u-margin__bottom--4']
])
Info
@endtypography
@card([
'attributeList' => [
'data-js-map-location' => json_encode(
array('lat' => '56.032075356631', 'lng' => '12.70340666113')
),
],
'classList' => [
'u-padding--2',
'u-margin__bottom--2'
]
])
@typography([
'element' => 'h3'
])
#Read me
@endtypography
@typography([
])
This element contains an attribute that automatically creates a pin and adds it to the map.
@endtypography
@endcard
@card([
'attributeList' => [
'data-js-map-location' => json_encode(
array(
'lat' => '56.052075356631',
'lng' => '12.70340666113',
'tooltip' => [
'title' => 'Tooltip title',
'excerpt' => 'Tooltip excerpt',
'directions' => [
'label' => 'Directions label',
'url' => 'https://www.google.com/maps/dir/?api=1&destination=56.052075356631,12.70340666113&travelmode=transit',
]
],
)
),
],
'classList' => [
'u-padding--2',
]
])
@typography([
'element' => 'h3'
])
#Click me
@endtypography
@typography([
])
A tooltip can also be added which has the same structure as a "pin" in the "pins" array. This tooltip will open when clicking on the connected element in the sidebar.
@endtypography
@endcard
@endslot
@endopenStreetMap
Blade component parameters
Key | Default value | Type | Available values | Description |
pins | [] | array | - | An array containing one array for each location marked on the map. Must contain latitude (lat) and longitude (lng). Can contain a tooltip and an icon. |
startPosition | [] | array | - | Sets the start location of the map. Must contain latitude (lat), longitude (lng) and a zoom value between 5-20 |
mapStyle | default | string | - | Theming of the map (pale, dark, color, default) |
height | 100vh | string | - | A css height value including unit (px, vh, %) |
fullWidth | false | boolean | - | True or false, sets the width of the element. |
expanded | false | boolean | - | True or false, sets the default expanded value of the sidebar. |
id | string | - | The DOM id of the component. | |
classList | [] | array | - | Array containing wrapping classes array |
attributeList | [] | array | - | Array containing keys and values rendered as attributes |
containerAware | false | boolean | true/false | Makes the component container aware. Appends modifiers --size--xs/sm/md/lg to the component. |