Actions

ThemeToggle

A native POST form for changing the color mode.

components.ThemeToggle · ThemeToggleProps

Use it well.

Place outside other forms. Supply your application's endpoint, cookies and CSRF policy; this demo already has the handler. The optional HTMX response redirects to a cleaned same-origin URL.

Explore the full demo →

This is the source compiled for the preview. Select the text to copy it, or download the file. Change the package name and demo routes for your application.

package examples

import "github.com/Tend-Stack/TendUI/v2026/components"

templ ExampleThemeToggle() {
	@components.ThemeToggle(components.ThemeToggleProps{Label: "Change color mode"})
}