State Management Demo

Demonstrates SwapState: maintaining complex UI state across requests without manual serialization. State is transparently preserved in the DOM and restored on the server.

1. URL & Filter State

Try searching, pagination, and sorting. The state is automatically serialized into query parameters or payload.

Sort by: Name | Price ⬆️
NameCategoryPrice
Chair Furniture ¤299.99
Desk Furniture ¤499.99

2. Multi-Step Form Wizard

Data entered in previous steps is preserved automatically as you navigate forward and backward. No hidden inputs required manually - the swap-state tag helper handles it.

Step 1 of 5 Personal Info

Personal Information

3 => "Preferences", 4 => "Payment", 5 => "Review", _ => "Unknown" }; }

3. Dashboard (State Persistence)

State persistence works even with partial updates. Clicking a card updates both the card (expanded state) and the global click counter, proving the state object was round-tripped and updated.

Live Dashboard

Global Clicks: 0

Click a card to expand/collapse details. Notice how the "Global Clicks" counter increments even though we are interacting with specific cards. The entire state object is being round-tripped.

💰 ▶️
Sales
$12,450
👥 ▶️
Users
1,234
📦 ▶️
Orders
89
🎫 ▶️
Support
7 tickets