Saltar al contenido principal

ChileMap

ChileMap renders the national topology as 16 region features. Unlike regional components, its topology prop is required.

import { ChileMap } from "react-chile-map";
import regiones from "react-chile-map/data/regiones.json";
import type { Topology } from "topojson-specification";

<ChileMap
topology={regiones as unknown as Topology}
data={{ "01": 42, "13": 100 }}
selected="13"
highlightMode="both"
onClick={(feature) => selectRegion(feature.code)}
/>;

Callbacks receive RegionFeature:

interface RegionFeature {
code: string;
name: string;
value?: number;
}

Use errorFallback and onTopologyError when accepting custom or user-provided topology. Packaged regiones.json is validated during development and release checks.

See the API reference for every shared prop.