Map
Use Map to display a map on a page. This component is useful for displaying a map of a location, such as a store or a customer’s address.
Anchor to propertiesProperties
- Anchor to accessibilityLabelaccessibilityLabelstring
A label that describes the purpose or contents of the map.
When set, it will be announced to users using assistive technologies and will provide them with more context.
- Anchor to apiKeyapiKeystring
A valid API key for the map service provider.
The map service provider may require an API key. Without an API key the map could be hidden or render in a limited developer mode.
- Anchor to blockSizeblockSizeSizeUnitsOrAutoDefault: 'auto'
Adjust the block size.
- string
A unique identifier for the element.
- Anchor to inlineSizeinlineSizeSizeUnitsOrAutoDefault: 'auto'
Adjust the inline size.
- Anchor to latitudelatitudenumberDefault: 0
Map center’s latitude in degrees.
- Anchor to longitudelongitudenumberDefault: 0
Map center’s longitude in degrees.
- Anchor to maxBlockSizemaxBlockSizeSizeUnitsOrNoneDefault: 'none'
Adjust the maximum block size.
- Anchor to maxInlineSizemaxInlineSizeSizeUnitsOrNoneDefault: 'none'
Adjust the maximum inline size.
- Anchor to maxZoommaxZoomnumberDefault: 18
The maximum zoom level which will be displayed on the map.
Valid zoom values are numbers from zero up to 18.
- Anchor to minBlockSizeminBlockSizeSizeUnitsDefault: '0'
Adjust the minimum block size.
- Anchor to minInlineSizeminInlineSizeSizeUnitsDefault: '0'
Adjust the minimum inline size.
- Anchor to minZoomminZoomnumberDefault: 0
The minimum zoom level which will be displayed on the map.
Valid zoom values are numbers from zero up to 18.
- Anchor to zoomzoomnumberDefault: 4
The initial Map zoom level.
Valid zoom values are numbers from zero up to 18. Larger zoom values correspond to a higher resolution.
MapElementProps
- accessibilityLabel
A label that describes the purpose or contents of the map. When set, it will be announced to users using assistive technologies and will provide them with more context.
string
- apiKey
A valid API key for the map service provider. The map service provider may require an API key. Without an API key the map could be hidden or render in a limited developer mode.
string
- blockSize
Adjust the block size.
SizeUnitsOrAuto
- id
A unique identifier for the element.
string
- inlineSize
Adjust the inline size.
SizeUnitsOrAuto
- latitude
Map center’s latitude in degrees.
number
- longitude
Map center’s longitude in degrees.
number
- maxBlockSize
Adjust the maximum block size.
SizeUnitsOrNone
- maxInlineSize
Adjust the maximum inline size.
SizeUnitsOrNone
- maxZoom
The maximum zoom level which will be displayed on the map. Valid zoom values are numbers from zero up to 18.
number
- minBlockSize
Adjust the minimum block size.
SizeUnits
- minInlineSize
Adjust the minimum inline size.
SizeUnits
- minZoom
The minimum zoom level which will be displayed on the map. Valid zoom values are numbers from zero up to 18.
number
- zoom
The initial Map zoom level. Valid zoom values are numbers from zero up to 18. Larger zoom values correspond to a higher resolution.
number
export interface MapElementProps extends Pick<MapProps$1, 'accessibilityLabel' | 'apiKey' | 'blockSize' | 'id' | 'inlineSize' | 'latitude' | 'longitude' | 'maxBlockSize' | 'maxInlineSize' | 'maxZoom' | 'minBlockSize' | 'minInlineSize' | 'minZoom' | 'zoom'> {
}
SizeUnitsOrAuto
SizeUnits | "auto"
SizeUnits
`${number}px` | `${number}%` | `0`
SizeUnitsOrNone
SizeUnits | "none"
Anchor to eventsEvents
- Anchor to boundschangeboundschange((event: CallbackEventListener<typeof tagName>) => void) | null
Callback when the viewport bounds have changed or the map is resized.
- Anchor to clickclick((event: CallbackEventListener<typeof tagName>) => void) | null
Callback when the user clicks on the map.
- Anchor to dblclickdblclick((event: CallbackEventListener<typeof tagName>) => void) | null
Callback when the user double-clicks on the map.
- Anchor to viewchangeviewchange((event: CallbackEventListener<typeof tagName>) => void) | null
Callback when the map view changes.
MapElementEvents
- boundschange
Callback when the viewport bounds have changed or the map is resized.
((event: CallbackEventListener<typeof tagName>) => void) | null
- click
Callback when the user clicks on the map.
((event: CallbackEventListener<typeof tagName>) => void) | null
- dblclick
Callback when the user double-clicks on the map.
((event: CallbackEventListener<typeof tagName>) => void) | null
- viewchange
Callback when the map view changes.
((event: CallbackEventListener<typeof tagName>) => void) | null
export interface MapElementEvents {
/**
* Callback when the viewport bounds have changed or the map is resized.
*/
boundschange?: ((event: CallbackEventListener<typeof tagName>) => void) | null;
/**
* Callback when the user clicks on the map.
*/
click?: ((event: CallbackEventListener<typeof tagName>) => void) | null;
/**
* Callback when the user double-clicks on the map.
*/
dblclick?: ((event: CallbackEventListener<typeof tagName>) => void) | null;
/**
* Callback when the map view changes.
*/
viewchange?: ((event: CallbackEventListener<typeof tagName>) => void) | null;
}
CallbackEventListener
(EventListener & {
(event: CallbackEvent<TTagName, TEvent>): void;
}) | null
CallbackEvent
TEvent & {
currentTarget: HTMLElementTagNameMap[TTagName];
}
Anchor to mapmarkerMapMarker
Use MapMarker to display a marker on a map. Use only as a child of s-map
component.
- Anchor to accessibilityLabelaccessibilityLabelstring
A label that describes the purpose of the marker. When set, it will be announced to users using assistive technologies and will provide them with more context.
- Anchor to clusterableclusterablebooleanDefault: false
Allows grouping the marker in clusters when zoomed out.
- Anchor to latitudelatitudenumberDefault: 0
Marker’s location latitude in degrees.
- Anchor to longitudelongitudenumberDefault: 0
Marker’s longitude latitude in degrees.
MapMarkerElementProps
- accessibilityLabel
A label that describes the purpose of the marker. When set, it will be announced to users using assistive technologies and will provide them with more context.
string
- clusterable
Allows grouping the marker in clusters when zoomed out.
boolean
- latitude
Marker’s location latitude in degrees.
number
- longitude
Marker’s longitude latitude in degrees.
number
export interface MapMarkerElementProps extends Pick<MapMarkerProps$1, 'accessibilityLabel' | 'blockSize' | 'clusterable' | 'inlineSize' | 'latitude' | 'longitude'> {
}
Anchor to eventsEvents
- Anchor to clickclick((event: CallbackEventListener<typeof tagName>) => void) | null
Callback when a marker is clicked.
It does not trigger a click event on the map itself.
MapMarkerElementEvents
- click
Callback when a marker is clicked. It does not trigger a click event on the map itself.
((event: CallbackEventListener<typeof tagName>) => void) | null
export interface MapMarkerElementEvents {
/**
* Callback when a marker is clicked.
*
* It does not trigger a click event on the map itself.
*/
click?: ((event: CallbackEventListener<typeof tagName>) => void) | null;
}
CallbackEventListener
(EventListener & {
(event: CallbackEvent<TTagName, TEvent>): void;
}) | null
CallbackEvent
TEvent & {
currentTarget: HTMLElementTagNameMap[TTagName];
}
Anchor to slotsSlots
- Anchor to graphicgraphicHTMLElement
The graphic to use as the marker.
If unset, it will default to the provider’s default marker.
MapMarkerElementSlots
- graphic
The graphic to use as the marker. If unset, it will default to the provider’s default marker.
HTMLElement
export interface MapMarkerElementSlots {
/**
* The graphic to use as the marker.
*
* If unset, it will default to the provider’s default marker.
*/
graphic?: HTMLElement;
}
Code
examples
Code
<s-map apikey="YOUR_API_KEY" latitude="51.5074" longitude="-0.1278"> <s-map-marker latitude="51.5074" longitude="-0.1278"></s-map-marker> </s-map>
Preview
