BlockDex

Components

Registries

Free blocks

Method

BlockDex

Components

Registries

Free blocks

Method

Open API

BlockDex

Components

Registries

Free blocks

Method

Open API

Components/remotionui/map-canvas

map-canvas

remotionui/map-canvas
FreeComponent

Deterministic MapLibre map mount

Live preview

live · rendered by the registry
Rendered by remotionui on their own page — this is the component running, not a screenshot of it.

Install it

npx shadcn@latest add https://remotionui.com/r/map-canvas.json

Source

registry/bases/default/primitives/map-canvas.tsxremotionui.com/r/map-canvas.json
1import { useEffect, useRef, useState } from "react";
2import {
3 AbsoluteFill,
4 useDelayRender,
5 useVideoConfig,
6} from "remotion";
7import type { Map } from "maplibre-gl";
8import "maplibre-gl/dist/maplibre-gl.css";
9import {
10 createMapInstance,
11 isMapStyleReady,
12 mapVignetteStyle,
13 MAP_THEME,
14 type LngLat,
15} from "@/remotion/lib/map-utils";
16
17export type MapCanvasProps = {
18 center: LngLat;
19 zoom?: number;
20 style?: string;
21 onMapReady?: (map: Map) => void;
22 backgroundColor?: string;
23 showVignette?: boolean;
24};
25
26export const MapCanvas: React.FC<MapCanvasProps> = ({
27 center,
28 zoom = 7,
29 style,
30 onMapReady,
31 backgroundColor = MAP_THEME.background,
32 showVignette = true,
33}) => {
34 const containerRef = useRef<HTMLDivElement>(null);
35 const mapRef = useRef<Map | null>(null);
36 const onMapReadyRef = useRef(onMapReady);
37 const { delayRender, continueRender } = useDelayRender();
38 const { width, height } = useVideoConfig();
39 const [loadingHandle] = useState(() => delayRender("Loading map"));
40
41 onMapReadyRef.current = onMapReady;
42
43 useEffect(() => {
44 if (!containerRef.current) {
45 return;
46 }
47
48 const mapInstance = createMapInstance(containerRef.current, width, height, {
49 center,
50 zoom,
51 style,
52 });
53 mapRef.current = mapInstance;
54
55 const notifyReady = () => {
56 if (!isMapStyleReady(mapInstance)) {
57 return;
58 }
59
60 mapInstance.jumpTo({ center, zoom });
61 mapInstance.once("idle", () => {
62 onMapReadyRef.current?.(mapInstance);
63 continueRender(loadingHandle);
64 });
65 };
66
67 if (mapInstance.loaded()) {
68 notifyReady();
69 } else {
70 mapInstance.on("load", notifyReady);
71 }
72 }, [continueRender, height, loadingHandle, style, width, zoom]);
73
74 useEffect(() => {
75 const mapInstance = mapRef.current;
76 if (!isMapStyleReady(mapInstance) || !mapInstance.loaded()) {
77 return;
78 }
79
80 mapInstance.jumpTo({ center, zoom });
81 mapInstance.triggerRepaint();
82 }, [center, zoom]);
83
84 return (
85 <AbsoluteFill style={{ backgroundColor }}>
86 <div
87 ref={containerRef}
88 style={{
89 width,
90 height,
91 position: "absolute",
92 }}
93 />
94 {showVignette ? <div style={mapVignetteStyle} /> : null}
95 </AbsoluteFill>
96 );
97};

Facts

Registry
remotionui
Type
registry:ui
Access
Free
Files written
0
Licence
MIT
First indexed
2026-08-07
Last confirmed
3 days ago

Go to the source

Docs on remotionui remotionui.com riaz37/remotion-ui on GitHub Raw registry item This item as JSON

More from remotionui

All 127 items
Same registry, same kind — the ones you would have found next
ComponentRegistryKindAccessInstallsCommand
audio-pulseaudio-pulseremotionuiComponentsFreeno deps
audiogram-barsaudiogram-barsremotionuiComponentsFreeno deps
blur-focus-inblur-focus-inremotionuiComponentsFreeno deps
blur-inblur-inremotionuiComponentsFreeno deps
blur-revealblur-revealremotionuiComponentsFreeno deps
caption-highlightcaption-highlightremotionuiComponentsFreeno deps
chromatic-aberration-wipechromatic-aberration-wiperemotionuiComponentsFreeno deps
confetti-burstconfetti-burstremotionuiComponentsFreeno deps
BlockDex

Built by

Kynth Studios

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

BlockDex

BlockDex

Built by

Kynth Studios

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

BlockDex

BlockDex

Built by

Kynth Studios

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

BlockDex