components

package
v0.0.0-...-2757dea Latest Latest
Warning

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

Go to latest
Published: Jun 6, 2025 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

templ: version: v0.2.793

Package components contains reusable Templ components.

Index

Constants

This section is empty.

Variables

View Source
var EmbedStatic embed.FS

Functions

func Button

func Button(props ButtonProps) templ.Component

func ServeStaticFiles

func ServeStaticFiles[state server.State](server *server.Server[state], endpoint string)

Serve the Apollo static files using the specified server at the specified endpoint. Applications should import the following files in the HTML header:

<link href="/<endpoint>/apollo.css" rel="stylesheet" defer/>

When using a local version of Apollo, you can set the APOLLO_STATIC_FILES environment variable to hot reload library styles.

Types

type ButtonProps

type ButtonProps struct {
	// The semantic button type, different types will have consistently different visual styles
	Type ButtonType `default:"ButtonType_Primary"`
	// The HTML button type
	HtmlType HtmlType `default:"HtmlType_Button"`
	// If set, clicking the button will trigger a htmx get request
	HxGet string
	// If set, the button will become a standalone, full-width button
	Block bool
	// If set, the button will function as a link
	Link bool
	// If set, the button will be disabled
	Disabled bool
	// Additional class(es) to append to the button element
	Class string
	// Additional attributes that will be added to the button element
	Attrs templ.Attributes
}

type ButtonType

type ButtonType int
const (
	ButtonType_Primary ButtonType = iota
	ButtonType_Secondary
	ButtonType_Accent
	ButtonType_Inverted
	ButtonType_Danger
)

type HtmlType

type HtmlType int
const (
	HtmlType_Button HtmlType = iota
	HtmlType_Submit
	HtmlType_Reset
)

Jump to

Keyboard shortcuts

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