Confinity Documentation
  • Latest Version
  • Latest Version
  • Getting Started

    • Introduction
    • Core Concepts
    • Create an Application
    • Glossary
  • Essentials

    • Authentication & SSO
    • Breaking Changes
    • Roslyn Source Analyzers
    • Changelog
    • ConfinityContent
    • ConfinitySelectable
    • Confinity Schedules
    • Data Seeding
    • Development guidelines [WIP]
    • Entity App
    • Entity Form
    • Entity Permissions
    • Frontend Configuration
    • Images
    • Known Issues
    • Localization
    • Migrations
    • Modules [WIP]
    • On-Site Editing
    • Settings
    • Cascade Delete
    • Replication
    • Infrastructure
  • Modules

    • Analytics Module
    • Assets Module
    • Blog Module
    • Cookie Consent Module
    • Forms Module
    • Friendly Captcha (Forms Module )
    • GeoIP Module
    • Htmx
    • Mail Module
    • Mailing Module
    • MediaPlayer Module
    • GoogleMyBusiness Module
    • OpenTelemetry Module
    • Pages Module [WIP]
    • Pattern Library Module
    • SIX Saferpay (worldline) Module
    • Products Module
    • Search Module
    • Wizard Module
  • Guides

    • Create a Custom Entity App Form Element
    • Date and Time
    • Entity Change Listener
    • File Upload / Temp File
    • HTTP security headers
    • conventions [WIP]
    • How to use Confinity with nginx
    • Notifications
    • Nullability
    • Rename Entity
    • Schedules
    • Useful snippets
    • Content Localization
  • Design Guidelines

    • Introduction
    • Page Components
    • Forms Module

Htmx

The Confinity Page Module has an integration for htmx. It allows re-rendering of single ConfinityContent components which are on a page.

That the ConfinityContent component can be found the according id must be passed over as an additional header. This can be done natively with hx-headers='{"hx-confinity-component": "@Model.Id"}' or by using our tag helper hx-confinity-content="@Model.Id". Apart from this, htmx has no further limitations.

Setup

  1. Add the HtmxModule module.
  2. Make sure you provide the htmx javascript where needed

Accessing hx

Data passed from htmx can be accessed by injecting HtmxContext.

Example Component

@using Confinity.Htmx
@model DocsDemos.Modules.Htmx.HtmxSimpleComponent.HtmxSimpleComponent
@addTagHelper *, Confinity.Htmx

<div hx-get="?" hx-confinity-content="@Model.Id" hx-swap="HtmxSwapping.OuterHtml">
    The server time is: @DateTimeOffset.Now.ToString("HH:mm:ss zz")
    <button hx-submit>Refresh</button>
</div>

Prev
GeoIP Module
Next
Mail Module