Skip to content

Address Map

The AddressMap component renders a static map image with a pin marker for a given address. No lat/lon required - the component geocodes the address automatically via Mapbox.

This is the same map used inside the QualificationQuestions review card, extracted as a standalone component for use on any page.

AddressMap component

Basic usage

import { AddressMap } from '@opendoor/partner-sdk-client-react';
<AddressMap
address={{
street1: '123 Main St',
city: 'Austin',
state: 'TX',
postalCode: '78701',
}}
onLoad={() => console.log('Map loaded')}
onError={(err) => console.log('Map failed:', err.message)}
/>;

Props

PropTypeDefaultDescription
addressAddressRequiredAddress to display on the map
appearanceOpendoorAppearance{ theme: 'default' }Visual theme configuration
mapboxAccessTokenstringBuilt-in tokenOverride the Mapbox access token
mapPinMarkerstringBlue home pinCustom pin (Mapbox spec or image URL)
widthnumber640Map image width in pixels
heightnumber320Map image height in pixels
zoomnumber14Map zoom level
borderRadiusstringTheme defaultCSS border-radius override
onLoad() => void-Called when the map image loads
onError(error: Error) => void-Called when geocoding or image load fails

Callbacks & Events

CallbackTypeWhen it fires
onLoad() => voidMap image loads successfully
onError(error: Error) => voidGeocoding or image load fails

How it works

  1. Loading: Shows a grey background while the address is geocoded
  2. Geocoding: Converts the address string to coordinates via Mapbox Geocoding API
  3. Static image: Builds a Mapbox Static Images URL with the pin at the geocoded coordinates
  4. Fade-in: The map image fades in smoothly when loaded
  5. Error handling: If geocoding fails, the grey background remains and onError fires - you handle the fallback

Customization

Custom pin marker

// Mapbox built-in marker
<AddressMap address={address} mapPinMarker="pin-l-star+ff0000" />
// Custom image URL
<AddressMap address={address} mapPinMarker="https://your-cdn.com/pin.png" />

Custom dimensions

<AddressMap address={address} width={800} height={400} zoom={16} />

Error handling

<AddressMap
address={address}
onError={(err) => {
// Show your own fallback UI
setShowFallback(true);
}}
/>

Styling

The component uses the appearance prop for theming. The border radius defaults to var(--od-border-radius-inner) from the theme, or you can override it directly:

<AddressMap
address={address}
appearance={{ theme: 'minimal' }}
borderRadius="12px"
/>

The container maintains a 2:1 aspect ratio by default and fills the width of its parent. The map image uses object-fit: cover to fill the container.