Migrate to the Polaris map component
The Polaris map component displays a map on a page. It replaces the previous Map component and is available as <s-map> in API versions 2025-10 and newer.
Anchor to Updated propertiesUpdated properties
The following properties are different in the Polaris map component.
Anchor to onPresson Press
The previous Map onPress prop is now called onClick. The handler now receives a MapClickEvent instead of a MapLocation.
Migrating onPress to onClick
Latest (Preact)
import '@shopify/ui-extensions/preact';
import {render} from 'preact';
export default function extension() {
render(<Extension />, document.body);
}
function Extension() {
return (
<s-map
apiKey="YOUR_API_KEY"
latitude={43.6532}
longitude={-79.3832}
accessibilityLabel="Store location"
onClick={(event) => {
console.log('Clicked:', event.location.latitude, event.location.longitude);
}}
></s-map>
);
}Pre-Polaris (2025-07)
import {
reactExtension,
Map,
} from '@shopify/ui-extensions-react/checkout';
export default reactExtension(
'purchase.checkout.block.render',
() => <Extension />,
);
function Extension() {
return (
<Map
apiKey="YOUR_API_KEY"
latitude={43.6532}
longitude={-79.3832}
accessibilityLabel="Store location"
onPress={(location) => {
console.log('Clicked:', location.latitude, location.longitude);
}}
/>
);
}The previous Map onDoublePress prop is now called onDblClick. The handler now receives a MapDblClickEvent instead of a MapLocation.
Migrating onDoublePress to onDblClick
Latest (Preact)
import '@shopify/ui-extensions/preact';
import {render} from 'preact';
export default function extension() {
render(<Extension />, document.body);
}
function Extension() {
return (
<s-map
apiKey="YOUR_API_KEY"
latitude={43.6532}
longitude={-79.3832}
accessibilityLabel="Store location"
onDblClick={(event) => {
console.log('Double-clicked:', event.location.latitude, event.location.longitude);
}}
></s-map>
);
}Pre-Polaris (2025-07)
import {
reactExtension,
Map,
} from '@shopify/ui-extensions-react/checkout';
export default reactExtension(
'purchase.checkout.block.render',
() => <Extension />,
);
function Extension() {
return (
<Map
apiKey="YOUR_API_KEY"
latitude={43.6532}
longitude={-79.3832}
accessibilityLabel="Store location"
onDoublePress={(location) => {
console.log('Double-clicked:', location.latitude, location.longitude);
}}
/>
);
}The previous Map onBoundsChange prop still uses onBoundsChange in Preact, but the handler now receives a MapBoundsChangeEvent instead of a MapBounds value.
Migrating onBoundsChange handler arguments
Latest (Preact)
import '@shopify/ui-extensions/preact';
import {render} from 'preact';
export default function extension() {
render(<Extension />, document.body);
}
function Extension() {
return (
<s-map
apiKey="YOUR_API_KEY"
latitude={43.6532}
longitude={-79.3832}
accessibilityLabel="Store location"
onBoundsChange={(event) => {
console.log('NE:', event.bounds.northEast?.latitude, event.bounds.northEast?.longitude);
console.log('SW:', event.bounds.southWest?.latitude, event.bounds.southWest?.longitude);
}}
></s-map>
);
}Pre-Polaris (2025-07)
import {
reactExtension,
Map,
} from '@shopify/ui-extensions-react/checkout';
export default reactExtension(
'purchase.checkout.block.render',
() => <Extension />,
);
function Extension() {
return (
<Map
apiKey="YOUR_API_KEY"
latitude={43.6532}
longitude={-79.3832}
accessibilityLabel="Store location"
onBoundsChange={(bounds) => {
console.log('NE:', bounds.northEast.latitude, bounds.northEast.longitude);
console.log('SW:', bounds.southWest.latitude, bounds.southWest.longitude);
}}
/>
);
}Anchor to SizesSizes
The size properties accept updated values in the Polaris map component. Previous unitless number values map to pixels. For example, 300 is now '300px'.
| Property | Previous values | New values | Migration notes |
|---|---|---|---|
maxInlineSize | number | `${number}%` | 'fill' | `${number}px` | `${number}%` | '0' | 'none' | fill is removed. Use 100% instead. |
minInlineSize | number | `${number}%` | 'fill' | `${number}px` | `${number}%` | '0' | fill is removed. Use 100% instead. |
maxBlockSize | number | `${number}%` | 'fill' | `${number}px` | `${number}%` | '0' | 'none' | fill is removed. Use 100% instead. |
minBlockSize | number | `${number}%` | 'fill' | `${number}px` | `${number}%` | '0' | fill is removed. Use 100% instead. |
If you used Style.default().when() to make this property responsive, container queries replace the Style helper. Wrap your content in <s-query-container> and use @container syntax in the property value. Learn more in Migrate StyleHelper to container queries.
If you used Style.default().when() to make this property responsive, container queries replace the Style helper. Wrap your content in <s-query-container> and use @container syntax in the property value. Learn more in Migrate StyleHelper to container queries.
Anchor to New propertiesNew properties
The Polaris map component introduces the following new properties:
| New prop | Type | Description |
|---|---|---|
blockSize | `${number}px` | `${number}%` | '0' | 'auto' | Adjusts the block size of the map. |
inlineSize | `${number}px` | `${number}%` | '0' | 'auto' | Adjusts the inline size of the map. |
onViewChange | (event: MapViewChangeEvent) => void | Fires when the map's center or zoom changes. Replaces onCenterChange and onZoomChange. |
Anchor to Removed propertiesRemoved properties
The previous Map onCenterChange and onZoomChange props have been merged into a single onViewChange prop. The handler receives a MapViewChangeEvent with the new center (location.latitude, location.longitude) and zoom.
Migrating onCenterChange and onZoomChange to onViewChange
Latest (Preact)
import '@shopify/ui-extensions/preact';
import {render} from 'preact';
export default function extension() {
render(<Extension />, document.body);
}
function Extension() {
return (
<s-map
apiKey="YOUR_API_KEY"
latitude={43.6532}
longitude={-79.3832}
accessibilityLabel="Store location"
onViewChange={(event) => {
console.log('Center:', event.location.latitude, event.location.longitude);
console.log('Zoom:', event.zoom);
}}
></s-map>
);
}Pre-Polaris (2025-07)
import {
reactExtension,
Map,
} from '@shopify/ui-extensions-react/checkout';
export default reactExtension(
'purchase.checkout.block.render',
() => <Extension />,
);
function Extension() {
return (
<Map
apiKey="YOUR_API_KEY"
latitude={43.6532}
longitude={-79.3832}
accessibilityLabel="Store location"
onCenterChange={(location) => {
console.log('Center:', location.latitude, location.longitude);
}}
onZoomChange={(zoom) => {
console.log('Zoom:', zoom);
}}
/>
);
}