components

package
v0.0.0-...-7214de4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 27, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

templ: version: v0.3.898

templ: version: v0.3.898

Index

Constants

This section is empty.

Variables

View Source
var HelloWorldConfig = routes.RouteConfig[HelloWorldProps]{
	Type:       routes.STATIC,
	HttpMethod: routes.GET,
	Middleware: func(w http.ResponseWriter, r *http.Request) HelloWorldProps {
		return nil
	},
}
View Source
var LazyLoadConfig = routes.RouteConfig[LazyLoadProps]{
	Type:       routes.STATIC,
	HttpMethod: routes.GET,
	Middleware: func(w http.ResponseWriter, r *http.Request) LazyLoadProps {

		return false
	},
}

*

  • `LazyLoadConfig` sets up a static route for the lazy-loaded component. *
  • - `Type`: Set to `STATIC` so responses can be cached by CDNs like CloudFront.
  • - `HttpMethod`: Uses `GET`, which aligns with HTMX's default behavior for fetching content.
  • - `Middleware`: In this case, always returns `false` — because it is only called via HTMX
  • after the initial placeholder render, meaning this is *not* the first load. *
  • Note: The first render with `true` should be triggered from a parent component or page.

Functions

func HelloWorld

func HelloWorld(props HelloWorldProps) templ.Component

func LazyLoad

func LazyLoad(isFirstLoad LazyLoadProps) templ.Component

Types

type HelloWorldProps

type HelloWorldProps = interface{}

type LazyLoadProps

type LazyLoadProps = bool

*

  • `LazyLoadProps` defines the props passed to the `LazyLoad` component. *
  • It is a simple boolean value:
  • - `true` indicates the initial (placeholder) render — usually triggered from a full page render.
  • - `false` indicates the second load — when HTMX fetches the full content.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL