menu

package
v1.7.4 Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2026 License: GPL-2.0 Imports: 16 Imported by: 0

Documentation

Overview

templ: version: v0.3.1020

templ: version: v0.3.1020

templ: version: v0.3.1020

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetMenuDepthValue added in v1.7.2

func GetMenuDepthValue(ctx context.Context) int64

func SetMenuDepth added in v1.7.2

func SetMenuDepth(ctx context.Context, depth int64) context.Context

Types

type Action added in v1.7.2

type Action interface {
	IsShown(r *http.Request) bool
	Component(r *http.Request) templ.Component
}

type Actions added in v1.7.2

type Actions struct {
	Request   *http.Request
	ClassName string
	Actions   []Action
}

func (*Actions) Component added in v1.7.2

func (a *Actions) Component() templ.Component

func (*Actions) IsShown added in v1.7.2

func (a *Actions) IsShown() bool

func (*Actions) Render added in v1.7.2

func (a *Actions) Render(ctx context.Context, w io.Writer) error

type BaseAction added in v1.7.2

type BaseAction struct {
	ClassName string
	Show      func(r *http.Request) bool
	Text      func(ctx context.Context) string
	URL       func(r *http.Request) string
}

func (*BaseAction) Component added in v1.7.2

func (a *BaseAction) Component(r *http.Request) templ.Component

func (*BaseAction) IsShown added in v1.7.2

func (a *BaseAction) IsShown(r *http.Request) bool

type BaseItem

type BaseItem struct {
	ID       string
	ItemName string
	Hidden   bool
	Classes  []string
	Ordering int
	Label    string
}

func (*BaseItem) Component

func (i *BaseItem) Component() templ.Component

func (*BaseItem) Inner

func (i *BaseItem) Inner(hideLogo bool) templ.Component

func (*BaseItem) IsShown

func (i *BaseItem) IsShown() bool

func (*BaseItem) Name

func (i *BaseItem) Name() string

func (*BaseItem) Order

func (i *BaseItem) Order() int

type BaseSidePanel added in v1.7.2

type BaseSidePanel struct {
	ID           string
	Ordering     int
	TemplateName string
	Request      *http.Request
	PanelIcon    string
	PanelLabel   func(ctx context.Context) string
	Hidden       func(p *BaseSidePanel, r *http.Request) bool
	PanelMedia   func(p *BaseSidePanel, r *http.Request) media.Media
	Context      func(p *BaseSidePanel, r *http.Request, c ctx.Context) ctx.Context
}

func (*BaseSidePanel) Content added in v1.7.2

func (p *BaseSidePanel) Content() templ.Component

func (*BaseSidePanel) Icon added in v1.7.2

func (p *BaseSidePanel) Icon() templ.Component

func (*BaseSidePanel) IsShown added in v1.7.2

func (p *BaseSidePanel) IsShown() bool

func (*BaseSidePanel) Label added in v1.7.2

func (p *BaseSidePanel) Label() string

func (*BaseSidePanel) Media added in v1.7.2

func (p *BaseSidePanel) Media() media.Media

func (*BaseSidePanel) Name added in v1.7.2

func (p *BaseSidePanel) Name() string

func (*BaseSidePanel) Order added in v1.7.2

func (p *BaseSidePanel) Order() int
type DropdownItem SubmenuItem
func (s *DropdownItem) Component() templ.Component
func (d *DropdownItem) IsShown() bool
func (d *DropdownItem) Name() string
func (d *DropdownItem) Order() int

type Item

type Item struct {
	BaseItem
	Link        func() string
	LinkID      string
	LinkClasses []string
}

func (*Item) Component

func (i *Item) Component() templ.Component

func (*Item) Order

func (i *Item) Order() int
type Menu struct {
	ID          string
	Classes     []string
	ItemClasses []string
	Items       []MenuItem
}
func (m *Menu) Component() templ.Component
func (m *Menu) HTML() string
func (m *Menu) MenuItems() []MenuItem
type MenuItem interface {
	// Order is used to sort the menu items
	//
	// The menu items are sorted in ascending order
	//
	// I.E. The menu item with the lowest order will be displayed first
	//
	// If two menu items have the same order, they will remain in the order they were added
	Order() int

	// IsShown is used to determine if the menu item should be displayed
	IsShown() bool

	// Implement a method for the templ.Component interface
	//
	// We explicitly only render the menu with the templ generated code.
	Component() templ.Component

	// Name is used to identify the menu item
	//
	// The name should be unique
	Name() string
}

type SidePanel added in v1.7.2

type SidePanel interface {
	Order() int
	Name() string
	IsShown() bool
	Media() media.Media
	Label() string
	Icon() templ.Component
	Content() templ.Component
}

type SidePanels added in v1.7.2

type SidePanels struct {
	ActivePanel string
	Panels      []SidePanel
}

func (*SidePanels) Component added in v1.7.2

func (p *SidePanels) Component() templ.Component

func (*SidePanels) HasPanels added in v1.7.2

func (p *SidePanels) HasPanels() bool
type SubmenuItem struct {
	BaseItem
	MenuID      string
	MenuClasses []string
	Menu        *Menu
}
func (s *SubmenuItem) Component() templ.Component
func (s *SubmenuItem) IsShown() bool

Jump to

Keyboard shortcuts

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