Get started
Examples

Let readers switch terrain

Let readers switch terrain

The layers flag adds a button to the stack, and the stack renders the panel behind it. The panel reads its catalogue from the layers manifest through the provider's client.

import { MapControls, MapView, MountayaElementsProvider } from "@mountaya/elements-react";

export const Terrain = () => (
  <MountayaElementsProvider client={client} map={map}>
    <div style={{ height: 460, position: "relative" }}>
      <MapView center={[6.87, 45.85]} client={client} onReady={setMap} terrain="topo" zoom={12} />
      <MapControls
        layers
        onClosePanel={() => setPanel(null)}
        onTogglePanel={(next) => setPanel((open) => (open === next ? null : next))}
        openPanel={panel}
        zoom
      />
    </div>
  </MountayaElementsProvider>
);

Mount a provider above the stack, or the button opens onto an empty catalogue.

Next steps