Ramstack.HtmxToolkit

Strongly typed HTMX integration for ASP.NET Core MVC, Razor Pages, and Minimal APIs.

Read HTMX request headers through C# properties, return response instructions with a fluent API, and generate request URLs through ASP.NET Core routing. The toolkit also provides MVC action attributes, version-specific HTMX configuration, and automatic antiforgery token delivery through the Toolkit script.

Get started

Install the NuGet package:

dotnet add package Ramstack.HtmxToolkit

Choose your starting point:

What you need Start here
Understand how HTMX and the toolkit fit together Overview
Build your first interaction Getting started, MVC, or Minimal APIs
Follow the course or find a task guide Guides
Look up a type or method API reference
Diagnose an integration problem Troubleshooting

Supported environments

The package targets .NET 6 and runs on .NET 6 or later. It supports HTMX 1.9.x, HTMX 2.x, and HTMX 4.x; HTMX 2.x is the default target.

Important

HtmxToolkit does not bundle HTMX. Add the matching HTMX client release to the application separately.