Skip to content

Commit 0b62447

Browse files
committed
fix(Map): show only tile provider attribution without framework branding
Add AttributionCustomizer component to display only tile provider attribution (e.g., "© OpenStreetMap contributors © CARTO") without the "Leaflet" prefix. This provides cleaner attribution when hideAttribution={false} is used, showing only the legally required tile provider credits.
1 parent 046d60a commit 0b62447

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

packages/ui/src/components/Map/MapContent.tsx

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,21 @@ function serializeSVGChild(element: React.ReactElement): string {
112112
return `<${tagName} ${attrString}>${childrenHTML}</${tagName}>`;
113113
}
114114

115+
// Component to show only tile provider attribution
116+
const AttributionCustomizer: React.FC = () => {
117+
const map = useMap();
118+
119+
useEffect(() => {
120+
// Show only tile provider attribution (no framework branding)
121+
const attributionControl = map.attributionControl;
122+
if (attributionControl) {
123+
attributionControl.setPrefix('');
124+
}
125+
}, [map]);
126+
127+
return null;
128+
};
129+
115130
// Component to handle map flying to selected location
116131
const MapFlyer: React.FC<{
117132
selectedId?: string;
@@ -584,6 +599,7 @@ export const MapContent: React.FC<MapViewProps> = ({
584599
touchZoom={scrollWheelZoom}
585600
dragging={true}
586601
>
602+
<AttributionCustomizer />
587603
<MapFlyer selectedId={selectedId} locations={locations} isInspectorOpen={isInspectorOpen} />
588604
{!scrollWheelZoom && <PinchZoomHandler />}
589605
<TileLayer

0 commit comments

Comments
 (0)