diff --git a/samples/HtmxorExamples/Components/Layout/MainLayout.razor b/samples/HtmxorExamples/Components/Layout/MainLayout.razor index 95d1462..4e550d5 100644 --- a/samples/HtmxorExamples/Components/Layout/MainLayout.razor +++ b/samples/HtmxorExamples/Components/Layout/MainLayout.razor @@ -1,4 +1,4 @@ @inherits LayoutComponentBase -
+
@Body
diff --git a/samples/HtmxorExamples/Components/Pages/Examples/OutOfBandOutlets/Index.razor b/samples/HtmxorExamples/Components/Pages/Examples/OutOfBandOutlets/Index.razor new file mode 100644 index 0000000..e68d9d0 --- /dev/null +++ b/samples/HtmxorExamples/Components/Pages/Examples/OutOfBandOutlets/Index.razor @@ -0,0 +1,37 @@ +@inherits ConditionalComponentBase +@attribute [HtmxLayout(typeof(OutOfBandHtmxLayout), Priority = 1)] +@layout OutOfBandMainLayout +@page "/examples/out-of-band-outlets" +@code { + [SupplyParameterFromForm] + private int CurrentCount { get; set; } = 0; + + private void IncrementCount(HtmxEventArgs args) + { + CurrentCount++; + } +} +Htmxor - Examples - Out of Band Outlets + +

This is an example of a counter updating and a element in the header also updating out of bounds.

+ +
+ + + + The count is @(CurrentCount % 2 == 0 ? "even" : "odd")! + + + +

+ Current count: @CurrentCount +

+ +
+
diff --git a/samples/HtmxorExamples/Components/Pages/Examples/OutOfBandOutlets/OutOfBandHtmxLayout.razor b/samples/HtmxorExamples/Components/Pages/Examples/OutOfBandOutlets/OutOfBandHtmxLayout.razor new file mode 100644 index 0000000..e646a1c --- /dev/null +++ b/samples/HtmxorExamples/Components/Pages/Examples/OutOfBandOutlets/OutOfBandHtmxLayout.razor @@ -0,0 +1,3 @@ +@inherits HtmxLayoutComponentBase + +@Body diff --git a/samples/HtmxorExamples/Components/Pages/Examples/OutOfBandOutlets/OutOfBandMainLayout.razor b/samples/HtmxorExamples/Components/Pages/Examples/OutOfBandOutlets/OutOfBandMainLayout.razor new file mode 100644 index 0000000..6843358 --- /dev/null +++ b/samples/HtmxorExamples/Components/Pages/Examples/OutOfBandOutlets/OutOfBandMainLayout.razor @@ -0,0 +1,8 @@ +@inherits LayoutComponentBase +
+ This header contains content that can be updated out of bounds: + +
+
+ @Body +
diff --git a/samples/HtmxorExamples/Components/Pages/Home.razor b/samples/HtmxorExamples/Components/Pages/Home.razor index 32b0419..18b7106 100644 --- a/samples/HtmxorExamples/Components/Pages/Home.razor +++ b/samples/HtmxorExamples/Components/Pages/Home.razor @@ -23,11 +23,25 @@ Updating Other Content - Triggering Events - Demonstrates how to update content beyond just the target elements by triggering events on the client using HX-Trigger response header. + + Demonstrates how to update content beyond just the target elements by + triggering events on the client using HX-Trigger response header. + Updating Other Content - Triggering Events Indirectly - Demonstrates how to update content beyond just the target elements by triggering events on the client using HX-Trigger response header from another routable component. + + Demonstrates how to update content beyond just the target elements by + triggering events on the client using HX-Trigger response header from another routable component. + + + + Out of Band Outlets + + Shows how you can leverage SectionContent and SectionOutlet components in Blazor to dynamically + add out-of-band content to a htmx response. The key is to have the SectionOutlet component in both + the MainLayout and in the Htmx specific layout. + diff --git a/samples/HtmxorExamples/Components/_Imports.razor b/samples/HtmxorExamples/Components/_Imports.razor index 709d9fb..8b6f697 100644 --- a/samples/HtmxorExamples/Components/_Imports.razor +++ b/samples/HtmxorExamples/Components/_Imports.razor @@ -2,6 +2,7 @@ @using System.Net.Http @using System.Net.Http.Json @using HtmxorExamples.Components.Layout +@using Microsoft.AspNetCore.Components.Sections @using Microsoft.AspNetCore.Components.Forms @using Microsoft.AspNetCore.Components.Routing @using Microsoft.AspNetCore.Components.Web