# Out-of-Band Swaps When an HTMX request updates an inner container (such as `#content`), surrounding layout controls, sidebars, breadcrumb trails, unread notification badges, and flash messages, do not update automatically. `Swap` represents an out-of-band fragment appended to your HTTP response, instructing HTMX to update those peripheral regions in the same roundtrip. ## Auto-Wrapped vs. Unwrapped Swaps `django-htmx-nav` supports two distinct templating styles: **auto-wrapped** (declarative Python) and **unwrapped** (self-contained templates). ### 1. Auto-Wrapped Swaps (Default) When you specify `target_id`, `Swap` automatically wraps your template's inner HTML in a container with the appropriate `hx-swap-oob` attribute: ```python Swap("nav/_sidebar.html", {"active": "tickets"}, target_id="sidebar") ``` Your template only contains the inner HTML: ```html ``` When rendered, `Swap` wraps the output automatically: ```html ``` ### 2. Unwrapped Swaps (Avoiding Auto-Wrapping) If you prefer your templates to own their outer element, or if you are migrating existing HTMX templates, you can **avoid auto-wrapping entirely by omitting `target_id`** (or passing `target_id=None`): ```python # No target_id specified — template is rendered exactly as-is: Swap("nav/_sidebar.html", {"active": "tickets"}) ``` Your template defines its own root element and `hx-swap-oob` attribute: ```html ``` #### Why Choose Unwrapped Swaps? - **Semantic HTML:** You can use `