ST.Blazor.Leaflet 8.194.3

dotnet add package ST.Blazor.Leaflet --version 8.194.3
                    
NuGet\Install-Package ST.Blazor.Leaflet -Version 8.194.3
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="ST.Blazor.Leaflet" Version="8.194.3" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="ST.Blazor.Leaflet" Version="8.194.3" />
                    
Directory.Packages.props
<PackageReference Include="ST.Blazor.Leaflet" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add ST.Blazor.Leaflet --version 8.194.3
                    
#r "nuget: ST.Blazor.Leaflet, 8.194.3"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package ST.Blazor.Leaflet@8.194.3
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=ST.Blazor.Leaflet&version=8.194.3
                    
Install as a Cake Addin
#tool nuget:?package=ST.Blazor.Leaflet&version=8.194.3
                    
Install as a Cake Tool

<div align="center"> <img src="media/logo.png" width=300> <h1>ST.Blazor.Leaflet</h1> <div> <a href="#description">Description</a> • <a href="#installation">Installation</a> • <a href="#samples">Samples</a> </div> </div>

License

This is a fork of the project ACO.Blazor.Leaflet from ACO Ahlmann SE & Co. KG and BlazorLeafet from Mehigh17. The License itself can be found here (MIT License)

Description

ST.Blazor.Leaflet is a wrapper offering easy-to-use Blazor components that expose the <a href="https://leafletjs.com/">Leaflet API</a> in C#. It allows you to create easily customizable maps without getting outside your existing .NET ecosystem.

The wrapper is still in its early days so it's very lackluster and doesn't expose the entirety of leaflet's API.

Check out the samples project to learn how to use it.

<img src="media/example1.gif" height=400>

Installation

Install the package in the target project:

<b>NuGet package is not pushed yet - if you want to use this fork you have to clone it manually right now</b>

dotnet add package ST.Blazor.Leaflet

In your App.razor/_Host.cshtml/_Layout.cshtml (Blazor Web App / Server) or index.html (Blazor WebAssembly), reference the interoperability script in the <head> element like so:


<script src="_content/ST.Blazor.Leaflet/leafletBlazorInterops.js"></script>
<script type="module" src="_content/ST.Blazor.Leaflet/leafletBlazorInterops.js"></script>

You can now use the components and the rest of the library.

Samples

Create the map

@using ST.Blazor.Leaflet
@using ST.Blazor.Leaflet.Models
@inject IJSRuntime jsRuntime


<div id="mapContainer" style="width: 300px; height: 300px;">
    <LeafletMap Map="_map" />
</div>

Bind the parameters to the respective objects like so

private Map _map = new Map(jsRuntime);
private PointF _startAt = new PointF(47.5574007f, 16.3918687f);

Add a marker with a tooltip and an icon

// Create the marker
var marker = new Marker(0.23f, 32f);
marker.Tooltip = new Tooltip { Content = "This is a nice location!" };
marker.Icon = new Icon { Url = "... some url" };

// Add it to the layers collection
_map.AddLayer(marker);

Or add a rectangle that highlights a zone

var rect = new Rectangle { Shape = new RectangleF(21f, 20f, 10f, 20f) };
rect.Fill = true; // This will fill the rectangle with a color
rect.FillColor = Color.Red; // Make the filled area red
rect.Popup = new Popup { Content = "This is a restricted area!" }; // Create a popup when the area is clicked

// Add it to the layers collection
_map.RemoveAdd(rect);

Or fit bounds on certain corners

_map.FitBounds(new PointF(45.943f, 24.967f), new PointF(46.943f, 25.967f), maxZoom: 5f);
Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
8.194.3 183 6/14/2025
8.194.2 150 6/14/2025
8.194.1 148 6/14/2025
8.194.0 152 6/14/2025