Dotted Map

An interactive world map visualization with customizable markers and styling.

Installation

pnpm dlx shadcn-svelte@latest add /r/dotted-map.json

Usage

<script lang="ts">	import { DottedMap } from "#lib/components/magic/dotted-map/index.js";
	const markers = [{ lat: 40.7128, lng: -74.006, size: 0.4 }];</script>
<div class="h-80 w-full">	<DottedMap {markers} /></div>

Examples

Custom Dot Radius

Customize the size of the dots on the map for a finer or coarser appearance.

Props

Dotted Map

An SVG-based world map with dots and customizable markers.

NameTypeDefaultDescription
widthnumber150Width of the map
heightnumber75Height of the map
mapSamplesnumber5000Number of dots to render on the map
markersMarker[][]Array of marker objects with lat, lng, and optional size
dotColorstringundefinedColor of the dots (uses currentColor if not specified)
markerColorstring#FF6900Color of the marker dots
dotRadiusnumber0.2Radius of each dot
staggerbooleantrueWhether to stagger alternating rows
classClassValue""Additional CSS classes to apply
stylestring""Inline styles to apply

Marker

Marker object interface for specifying locations on the map.

NameTypeDefaultDescription
latnumberrequiredLatitude of the marker
lngnumberrequiredLongitude of the marker
sizenumberdotRadiusOptional custom size for this marker