@openweather/maps-react
React bindings, in three subpaths. Peer-depends on react/react-dom ≥ 18; only ./maplibre
additionally needs @openweather/maps-maplibre + maplibre-gl ≥ 5 — importing . or ./ui never pulls
MapLibre into your bundle.
. (main barrel) — providers, hooks, headless compounds
Unchanged by the simple-kit restructure — everything below still renders exactly as before.
| Category | Exports |
|---|---|
| Providers | MapsProviders, SettingsProvider, MapControllerProvider, LayersProvider |
| Hooks | useMapController, useMapControllerActions, useFlyTo, useLayers, useLayersActions, useTimeline, useTimelineActions, useTimelineScrub, usePointQuery, usePointQueryActions, usePointQueryAtCoordinate, useSearch, useSearchActions, useSearchAndFlyTo, useSelectedSearchResult, useSettings, useSettingsActions, usePointFlowStore, useOverlays |
| Compounds | Timeline (.Provider/.Track/.Scrubber/.Ticks/.AnimationControl), Layers (.Provider/.List/.Item/.ModelPicker), Search (.Provider/.Bar/.Input/.Results/.Item) |
| Standalone | LockedLayerPrompt |
See Providers & Hooks and Headless Compounds for full signatures and examples.
./ui — the simple UI kit
import {
LayerPanel,
TimelineSlider,
LegendBar,
OverlayToggles,
SearchBox,
PointQueryBox,
ZoomControl,
Shell,
ErrorBox,
} from '@openweather/maps-react/ui';
One React component per DOM control in @openweather/maps-ui, stamping the same data-owm-part values —
see each page under Simple UI Kit for props and examples.
LayerRail, TimelineControl, SearchControl, OverlayControls, PointQueryPopup,
DetailPanel, ChromeVisibility/useChromeVisibility, and the headless Overlays compound this
subpath used to also export are gone — that fuller designed UI, and the One Call detail panel's
data model, now live in a separate weather-maps website repo.
./maplibre — the mountable map
import { WeatherMap, SimpleMapUI, useWeatherMap } from '@openweather/maps-react/maplibre';
| Export | Notes |
|---|---|
WeatherMap |
Mounts createWeatherMap into an owned <div>, wraps children in <MapsProviders> once it resolves. Props: UseWeatherMapOptions (= WeatherMapOptions minus container) + className/style/children render-prop |
useWeatherMap(container, options) |
The hook <WeatherMap> is built on, if you want to own the container element yourself |
SimpleMapUI |
The simple kit's whole demo chrome as one component, replacing <WeatherMapUI> — see React guide. Also takes a children prop rendered inside the same <MapsProviders> tree it sets up |
Styles
@openweather/maps-react/styles.css re-exports @openweather/maps-ui-core's tokens.css + simple.css — the same
stylesheet @openweather/maps-ui uses, so a <SimpleMapUI> page and a createSimpleMapUI() page render
identically out of the box.
Testing conventions
<WeatherMap>'s underlying useWeatherMap is StrictMode-safe by construction: each
mount→unmount→remount cycle's cleanup is unconditional and immediate, so a handle that resolves
after its effect was already cleaned up self-destructs instead of leaking a MapLibre/WebGL context.
usePointFlowStore() and useTimelineModel() follow the same create-and-destroy-inside-one-effect
pattern for the same reason — see either hook's own doc comment in source for the specific bug this
avoids.