Map
Create a MapLibre viewport with host-supplied styles and viewport callbacks..
Create a MapLibre viewport with host-supplied styles and viewport callbacks.
Public import
svelte
<script lang="ts">
import { Map } from "rom-ui/maps";
import "rom-studio/styles";
</script> Composition and responsibility
The host supplies data, callbacks and application policy. The component does not provide persistence or authorization.
Public names: Map.
Declared props
This declaration comes from the installed package. Imported types retain their upstream meaning.
ts
interface Props {
label?: string;
loadingLabel?: string;
errorLabel?: string;
onerror?: (error: Error) => void;
children?: import("svelte").Snippet;
class?: string;
styles?: {
light?: MapStyleOption;
dark?: MapStyleOption;
};
theme?: "light" | "dark";
/** Map projection type. Use `{ type: "globe" }` for 3D globe view. */
projection?: MapLibreGL.ProjectionSpecification;
center?: [number, number];
zoom?: number;
options?: Omit<MapLibreGL.MapOptions, "container" | "style">;
/**
* Bindable reference to the underlying MapLibre map instance.
* Useful for calling map methods imperatively from the parent.
*/
map?: MapLibreGL.Map | null;
/**
* Controlled viewport. When provided with onViewportChange,
* the map becomes controlled and viewport is driven by this prop.
*/
viewport?: Partial<MapViewport>;
/**
* Callback fired continuously as the viewport changes (pan, zoom, rotate, pitch).
* Can be used standalone to observe changes, or with `viewport` prop
* to enable controlled mode where the map viewport is driven by your state.
*/
onviewportchange?: (viewport: MapViewport) => void;
/**
* Callback fired after each style load completes (initial load and subsequent style changes).
* Runs after any viewport restoration, so it's safe to call map methods here.
*/
onstyleloaded?: () => void;
/** Show a loading indicator on top of the map. */
loading?: boolean;
} Source and version
ROM UI 0.1.0-alpha.7. Component source.
Install the optional maplibre-gl peer and its styles. Provider contracts and attribution remain host responsibilities.
See the composition guide for host integration boundaries.
This page follows the captured repository source.View the source