A library providing access to browser local storage with automatic serialization for Blazor applications.
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.
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.
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.
A library to provide access to local storage in Blazor applications
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Handles all serialization and deserialization automatically when saving or retrieving values, eliminating manual JSON handling and reducing boilerplate code.
Provides both asynchronous ILocalStorageService and synchronous ISyncLocalStorageService interfaces, catering to different Blazor hosting models and use cases, with sync methods available in WebAssembly.
Offers a streaming implementation for Blazor Server to bypass SignalR message size limits (default 32KB), enabling storage of large objects without data loss.
Includes bUnit test extensions via the Blazored.LocalStorage.TestExtensions package, allowing easy mocking of local storage for realistic component testing.
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.
Synchronous operations are only available in Blazor WebAssembly; Blazor Server developers must use async methods, complicating code in scenarios where sync access is preferred.
To use streaming in Blazor Server, developers must register special services with AddBlazoredLocalStorageStreaming() and add a JavaScript file, adding extra steps beyond basic configuration.