Core Feature
SwapResponse
Update multiple UI elements with a single HTTP response. One request, many updates, zero JavaScript.
The Problem
A single user action often needs to update multiple parts of your page. Add an item to a cart? Update the cart count, the cart preview, AND the product card.
The Solution
SwapResponse() lets you update multiple page elements, show toasts, and trigger events—all in one HTTP response.
return SwapResponse()
.WithView("_ProductCard", product)
.AlsoUpdate("cart-count", "_CartCount", cart.ItemCount)
.WithSuccessToast("Added to cart!")
.Build();
Toast Notifications
.WithSuccessToast("Saved!")
.WithErrorToast("Something went wrong")
.WithInfoToast("Processing...")
Client Events & URL Management
.TriggerClientEvent("modalOpened", new { id = "modal" })
.PushUrl($"/products/{product.Id}")
.Redirect("/products")
Builder Methods
- .WithView()
- .AlsoUpdate()
- .WithSuccessToast()
- .WithOobSwap()
- .TriggerClientEvent()
- .PushUrl()
- .Build()