Components

Button

hitmix/components/button is a ready-made button that wires htmx attributes straight through, so a single tag can post to a route and swap the response in without any extra markup.

Usage

<import src="hitmix/components/button" as="button" />

<button
  hx-post="/"
  hx-target="#greeting-result"
  hx-swap="innerHTML"
  label="Say hello"
/>

Props

  • label — the button text (defaults to "Click me")
  • hx-post — the route to submit to
  • hx-target — the element the response replaces
  • hx-swap — how the response is swapped in (e.g. innerHTML)
  • hx-vals — a JSON string of extra values to send with the request