loading
Part of bit platform

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).

Shell
dotnet add package Bit.Butil
Razor
@inject Bit.Butil.Clipboard clipboard
@inject Bit.Butil.Geolocation geolocation
@inject Bit.Butil.LocalStorage localStorage

<button @onclick="Share">Share my position</button>

@code {
    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);
    }
}
61 Documented APIs
100% C# No JS to write
1 Script tag to add
.NET 8.0+ Framework

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.

Note:
Everything on this site is live Every page pairs the documentation with interactive samples running against the real browser APIs - what you click is what the library does.

The catalogue

61 browser APIs and 6 guides, every one of them with runnable samples. Press Ctrl K to jump straight to one.

Overview 6

Window & Browsing 7

Screen & Diagnostics 6

DOM & Interaction 8

Storage 7

Files & Data 7

Network & Workers 7

Device & Hardware 11

Identity & Permissions 3

Media & Speech 5

An unhandled error has occurred. Reload 🗙