dioxus-client-storage
Unified storage API for Dioxus supporting LocalStorage, SessionStorage, and IndexedDB.
Features
- 💾 LocalStorage - Persistent key-value storage
- 📂 SessionStorage - Per-session key-value storage
- 🗄️ IndexedDB - Large structured data (via
dioxus-indexeddb) - 🪝 Reactive hooks -
use_local_storage,use_session_storage - ⚡ Sync & async APIs for different use cases
Installation
[]
= "0.0.1"
With specific features:
# Only LocalStorage
= { = "0.0.1", = false, = ["localstorage"] }
# Only IndexedDB
= { = "0.0.1", = false, = ["indexeddb"] }
# All storage types
= { = "0.0.1", = ["indexeddb", "localstorage", "sessionstorage"] }
LocalStorage
Persistent storage that survives page reloads and browser restarts.
use *;
use *;
Direct API
use LocalStorage;
let storage = new;
// Store
storage.set?;
// Retrieve
let value: = storage.get?;
// Remove
storage.remove?;
// Clear all
storage.clear?;
SessionStorage
Storage that persists only for the current session (tab).
use *;
use *;
IndexedDB Integration
When the indexeddb feature is enabled:
use *;
use *;
use ;
Choosing the Right Storage
| Storage | Capacity | Persistence | Use Case |
|---|---|---|---|
| LocalStorage | ~5-10 MB | Permanent | User preferences, settings |
| SessionStorage | ~5-10 MB | Session only | Form drafts, wizard state |
| IndexedDB | Hundreds of MB | Permanent | Large datasets, offline apps |
License
MIT OR Apache-2.0