import React from 'react'; import { Map } from '../ui/map'; import { RouteMap } from '../ui/route-map'; export function ApiKeyMapExample() { const [key, setKey] = React.useState(''); const [appliedKey, setAppliedKey] = React.useState(''); const handleApply = () => { if (key) setAppliedKey(key); }; return (

Map with Explicit API Key

Enter a Google Maps API Key to load the maps below. This simulates a scenario where the key is provided dynamically or via props, overriding/fallback for the global context.

setKey(e.target.value)} placeholder="Enter Google Maps API Key" aria-label="Google Maps API Key" className="flex-1 px-4 py-2 border rounded-md bg-background" />
{appliedKey ? (

Standard Map

Route Map

) : (
Enter an API Key above to render the maps.
)}
); }