components

package
v4.0.0-beta.9 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

templ: version: v0.3.1070

templ: version: v0.3.1070

templ: version: v0.3.1070

templ: version: v0.3.1070

templ: version: v0.3.1070

Index

Constants

This section is empty.

Variables

View Source
var DeployTargetConfig = routes.RouteConfig[DeployTargetProps]{
	Type:       routes.DYNAMIC,
	HttpMethod: routes.GET,
	Middleware: func(w http.ResponseWriter, r *http.Request) DeployTargetProps {
		target := r.URL.Query().Get("target")
		switch target {
		case "gcp", "server":
			return target
		default:
			return "aws"
		}
	},
}
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 ImageDemoConfig = routes.RouteConfig[ImageDemoProps]{
	Type:       routes.STATIC,
	HttpMethod: routes.GET,
	Middleware: func(w http.ResponseWriter, r *http.Request) ImageDemoProps {
		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.
View Source
var McpSetupConfig = routes.RouteConfig[McpSetupProps]{
	Type:       routes.DYNAMIC,
	HttpMethod: routes.GET,
	Middleware: func(w http.ResponseWriter, r *http.Request) McpSetupProps {
		client := r.URL.Query().Get("client")
		switch client {
		case "opencode", "codex", "cursor":
			return client
		default:
			return "claude"
		}
	},
}

Functions

func DeployTarget

func DeployTarget(active DeployTargetProps) templ.Component

func HelloWorld

func HelloWorld(props HelloWorldProps) templ.Component

func ImageDemo

func ImageDemo(props ImageDemoProps) templ.Component

func LazyLoad

func LazyLoad(isFirstLoad LazyLoadProps) templ.Component

func McpSetup

func McpSetup(active McpSetupProps) templ.Component

Types

type DeployTargetProps

type DeployTargetProps = string

type HelloWorldProps

type HelloWorldProps = interface{}

type ImageDemoProps

type ImageDemoProps = 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.

type McpSetupProps

type McpSetupProps = string

Jump to

Keyboard shortcuts

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