components

package
v0.3.15 Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2025 License: MPL-2.0 Imports: 22 Imported by: 0

Documentation

Overview

templ: version: v0.3.833

templ: version: v0.3.833

Package components provides shared components for templ templates.

templ: version: v0.3.833

templ: version: v0.3.833

templ: version: v0.3.833

templ: version: v0.3.833

templ: version: v0.3.833

templ: version: v0.3.833

templ: version: v0.3.833

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AssetPath

func AssetPath(ctx context.Context, path string) (string, error)

func Authenticated

func Authenticated(ctx context.Context) bool

func BareLayout

func BareLayout(props BareLayoutProps) templ.Component
func BlockLink(path templ.SafeURL) string

func ContentList

func ContentList[T any](items []T, comp func(T) templ.Component) templ.Component
func Cookie(ctx context.Context, name string) string

func CopyableContent

func CopyableContent() templ.Component

func CurrentPath

func CurrentPath(ctx context.Context) string

func CurrentURL

func CurrentURL(ctx context.Context) string

func CurrentURLWithoutQuery

func CurrentURLWithoutQuery(ctx context.Context) string

func CurrentUsername

func CurrentUsername(ctx context.Context) (string, error)

func DeleteButton

func DeleteButton() templ.Component

func Flashes

func Flashes() templ.Component

func Identifier

func Identifier(id resource.ID) templ.Component

func IsOwner

func IsOwner(ctx context.Context, organization string) bool

func IsSiteAdmin

func IsSiteAdmin(ctx context.Context) bool

func Layout

func Layout(props LayoutProps) templ.Component

func PaginatedContentList

func PaginatedContentList[T any](page *resource.Page[T], comp func(T) templ.Component) templ.Component

func SearchDropdown

func SearchDropdown(props SearchDropdownProps) templ.Component

func Strikethrough

func Strikethrough(cond bool) templ.Component

func TokenFlashMessage

func TokenFlashMessage(w gohttp.ResponseWriter, token []byte) error

TokenFlashMessage is a helper for rendering a flash message with an authentication token.

Types

type BareLayoutProps

type BareLayoutProps struct {
	Title        string
	Organization string
	PreContent   templ.Component
	PostContent  templ.Component
}
type Breadcrumb struct {
	Name string
	Link templ.SafeURL
}
type DropDownUIWidth string
const (
	NarrowDropDown DropDownUIWidth = "narrow"
	WideDropDown   DropDownUIWidth = "wide"
)

type LayoutProps

type LayoutProps struct {
	Title          string
	Organization   string
	Breadcrumbs    []Breadcrumb
	ContentActions templ.Component
	ContentLinks   templ.Component
	ContentMenu    templ.Component
	PreContent     templ.Component
	PostContent    templ.Component
}

type SearchDropdownProps

type SearchDropdownProps struct {
	// Name to send along with value in the POST form
	Name string
	// Existing values to NOT show in the dropdown
	Existing []string
	// Available values to show in the dropdown
	Available []string
	// Action is the form action URL
	Action templ.SafeURL
	// Placeholder to show in the input element.
	Placeholder string
	// Width: "narrow" or "wide"
	Width DropDownUIWidth
}

type WebsocketListHandler added in v0.3.15

type WebsocketListHandler[Resource any, Options any] struct {
	logr.Logger
	Client    websocketListHandlerClient[Resource, Options]
	Component func(Resource) templ.Component
}

WebsocketListHandler handles dynamically updating lists of resources via a websocket.

func (*WebsocketListHandler[Resource, Options]) Handler added in v0.3.15

func (h *WebsocketListHandler[Resource, Options]) Handler(w http.ResponseWriter, r *http.Request)

Directories

Path Synopsis
Package paths are paths for use in templ templates.
Package paths are paths for use in templ templates.

Jump to

Keyboard shortcuts

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