menu

package
v1.6.9 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2024 License: GPL-2.0 Imports: 8 Imported by: 0

Documentation

Overview

templ: version: v0.2.707

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BaseItem

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

func (*BaseItem) Component

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

func (*BaseItem) Inner

func (i *BaseItem) Inner() 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 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
	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 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