components

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2025 License: MPL-2.0 Imports: 18 Imported by: 0

Documentation

Overview

templ: version: v0.3.943

templ: version: v0.3.943

Package components provides shared components for templ templates.

templ: version: v0.3.943

templ: version: v0.3.943

templ: version: v0.3.943

templ: version: v0.3.943

templ: version: v0.3.943

templ: version: v0.3.943

templ: version: v0.3.943

templ: version: v0.3.943

templ: version: v0.3.943

templ: version: v0.3.943

templ: version: v0.3.943

templ: version: v0.3.943

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Ago added in v0.3.16

func Ago(t time.Time) templ.Component

func AssetPath

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

func Authenticated

func Authenticated(ctx context.Context) bool

func Avatar added in v0.3.25

func Avatar(url *string) templ.Component

func BareLayout

func BareLayout(props BareLayoutProps) 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 CurrentUserAvatar added in v0.3.25

func CurrentUserAvatar() templ.Component

func CurrentUsername

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

func DeleteButton

func DeleteButton() templ.Component

func EditButton added in v0.3.17

func EditButton() templ.Component

func ExternalIcon added in v0.3.18

func ExternalIcon() templ.Component

func Filter added in v0.3.20

func Filter[T ~string](props FilterProps[T]) templ.Component

func Flashes

func Flashes() templ.Component

func Identifier

func Identifier(id resource.TfeID) templ.Component

func IsOwner

func IsOwner(ctx context.Context, organization resource.ID) bool

func IsSiteAdmin

func IsSiteAdmin(ctx context.Context) bool

func Layout

func Layout(props LayoutProps) templ.Component
func MenuItem(title string, path templ.SafeURL, matchPrefixes ...string) templ.Component

func PollingTable added in v0.4.8

func PollingTable[T any](populator TablePopulator[T], page *resource.Page[T]) templ.Component

PollingTable renders a table that polls for updates every X seconds.

func SearchDropdown

func SearchDropdown(props SearchDropdownProps) templ.Component

func Strikethrough

func Strikethrough(cond bool) templ.Component

func Table added in v0.3.16

func Table[T any](populator TablePopulator[T], page *resource.Page[T]) templ.Component

func ToBytes added in v0.3.24

func ToBytes(comp templ.Component) []byte

func ToString added in v0.3.24

func ToString(comp templ.Component) string

func TokenFlashMessage

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

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

func UnpaginatedTable added in v0.3.17

func UnpaginatedTable[T any](populator TablePopulator[T], resources []T) templ.Component

Types

type BareLayoutProps

type BareLayoutProps struct {
	Title        string
	Organization resource.ID
	Menu         templ.Component
	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 FilterProps added in v0.3.20

type FilterProps[T ~string] struct {
	Title            string
	All              []T
	Selected         []T
	ParamName        string
	Visible          bool
	VisibleParamName string
	Label            func(T) templ.Component
	CheckboxClass    func(T) string
}

type LayoutProps

type LayoutProps struct {
	Title          string
	Organization   resource.ID
	Breadcrumbs    []Breadcrumb
	ContentActions templ.Component
	ContentLinks   templ.Component
	ContentMenu    templ.Component
	PreContent     templ.Component
	PostContent    templ.Component
	Menu           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 TablePopulator added in v0.3.16

type TablePopulator[T any] interface {
	Header() templ.Component
	Row(T) templ.Component
}

TablePopulator populates a table component with resources of type T.

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