Open-Awesome
CategoriesAlternativesStacksSelf-HostedExplore
Open-Awesome

© 2026 Open-Awesome. Curated for the developer elite.

TermsPrivacyAboutGitHubRSS
  1. Home
  2. Blazor
  3. Blazored.LocalStorage

Blazored.LocalStorage

MITC#v4.5.0

A library providing access to browser local storage with automatic serialization for Blazor applications.

Visit WebsiteGitHubGitHub
1.3k stars134 forks0 contributors

What is Blazored.LocalStorage?

Blazored LocalStorage is a library that provides Blazor applications with access to the browser's local storage API. It handles the serialization and deserialization of data automatically, allowing developers to persist application state between sessions without manual JSON conversion. The library supports both Blazor WebAssembly and Blazor Server, with APIs for asynchronous and synchronous operations.

Target Audience

Blazor developers who need to persist client-side data, such as user preferences, form inputs, or application state, across browser sessions in a simple and efficient manner.

Value Proposition

Developers choose Blazored LocalStorage because it abstracts the complexities of the browser's local storage API, provides automatic serialization, and offers a clean, type-safe interface integrated with Blazor's dependency injection and lifecycle. Its support for custom serializers and testing utilities makes it a robust choice for production applications.

Overview

A library to provide access to local storage in Blazor applications

Use Cases

Best For

  • Persisting user preferences and settings in Blazor WebAssembly apps
  • Storing form data locally to prevent loss on page refresh
  • Caching API responses or computed data client-side in Blazor applications
  • Managing client-side application state across browser sessions
  • Testing Blazor components that interact with local storage using bUnit
  • Handling large data objects in Blazor Server with streaming support

Not Ideal For

  • Applications requiring synchronous local storage access in Blazor Server hosting models
  • Projects with strict backward compatibility needs that cannot tolerate breaking changes in serialization formats
  • Teams looking for a zero-configuration solution for handling large data objects in Blazor Server
  • Non-Blazor .NET projects that need client-side storage solutions

Pros & Cons

Pros

Automatic Serialization

Handles all serialization and deserialization automatically when saving or retrieving values, eliminating manual JSON handling and reducing boilerplate code.

Dual API Flexibility

Provides both asynchronous ILocalStorageService and synchronous ISyncLocalStorageService interfaces, catering to different Blazor hosting models and use cases, with sync methods available in WebAssembly.

Streaming for Large Data

Offers a streaming implementation for Blazor Server to bypass SignalR message size limits (default 32KB), enabling storage of large objects without data loss.

Integrated Testing Support

Includes bUnit test extensions via the Blazored.LocalStorage.TestExtensions package, allowing easy mocking of local storage for realistic component testing.

Cons

Breaking Serialization Changes

Version 4 introduced breaking changes to JSON serializer defaults, which can corrupt data stored with v3 and requires manual configuration to maintain compatibility, as detailed in the README.

Sync API Limited to WebAssembly

Synchronous operations are only available in Blazor WebAssembly; Blazor Server developers must use async methods, complicating code in scenarios where sync access is preferred.

Additional Setup for Streaming

To use streaming in Blazor Server, developers must register special services with AddBlazoredLocalStorageStreaming() and add a JavaScript file, adding extra steps beyond basic configuration.

Frequently Asked Questions

Quick Stats

Stars1,331
Forks134
Contributors0
Open Issues25
Last commit1 year ago
CreatedSince 2019

Tags

#hacktoberfest#nuget#webassembly#csharp#browser-api#localstorage#dotnet#blazor-server#serialization#blazored#client-side-storage#local-storage#blazor-webassembly#blazor#state-management#blazor-applications#blazor-interop

Built With

J
JavaScript
B
Blazor
.
.NET
C
C++
S
System.Text.Json

Links & Resources

Website

Included in

Blazor9.3k
Auto-fetched 7 hours ago

Related Projects

FluxorFluxor

Fluxor is a zero boilerplate Flux/Redux library for Microsoft .NET and Blazor.

Stars1,470
Forks164
Last commit4 days ago
bUnit - a testing library for Blazor componentsbUnit - a testing library for Blazor components

bUnit is a testing library for Blazor components that make tests look, feel, and runs like regular unit tests. bUnit makes it easy to render and control a component under test’s life-cycle, pass parameter and inject services into it, trigger event handlers, and verify the rendered markup from the component using a built-in semantic HTML comparer.

Stars1,296
Forks119
Last commit1 day ago
Blazor-StateBlazor-State

A Blazor State management library by TimeWarp.

Stars613
Forks57
Last commit4 months ago
TextCopyTextCopy

A cross platform package to copy text to and from the clipboard.

Stars572
Forks50
Last commit1 day ago
Community-curated · Updated weekly · 100% open source

Found a gem we're missing?

Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.

Submit a projectStar on GitHub