Browser APIs for Blazor,
without writing JavaScript
bit Butil wraps the entire browser platform - window, document, storage, crypto, media, sensors and much more - in strongly-typed C# classes you simply inject and call. It works in every interactive Blazor mode: WebAssembly, Server and Hybrid (MAUI).
dotnet add package Bit.Butil Bit.Butil.Clipboard clipboard
Bit.Butil.Geolocation geolocation
Bit.Butil.LocalStorage localStorage
<button @onclick="Share">Share my position</button>
{
private async Task Share()
{
var pos = await geolocation.GetCurrentPosition();
var here = $"{pos.Coords.Latitude}, {pos.Coords.Longitude}";
await clipboard.WriteText(here);
await localStorage.SetItem("last-share", here);
}
}Typed, not stringly
Every API is a class with real parameters, real return types and XML documentation - so IntelliSense, the compiler and refactoring all work on your browser code the way they work on the rest of it.
Every render mode
The same call compiles and runs under WebAssembly, Server and Hybrid, and returns a safe default while a page is being prerendered instead of throwing. How that works.
Honest about the platform
A wrapper cannot add a feature the engine has not shipped. Every page says what its API needs, and the support matrix tests the browser you are reading this in.
The catalogue
136 browser APIs and 6 guides, every one of them with runnable samples. Press Ctrl K to jump straight to one.