menu

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: May 5, 2026 License: MIT Imports: 22 Imported by: 0

Documentation

Overview

Package menu provides constructors and methods for the HTML <menu> element.

The <menu> HTML element is a semantic alternative to <ul>, but treated by browsers (and exposed through the accessibility tree) as no different than <ul>. It represents an unordered list of items (which are represented by <li> elements).

Index

Constants

This section is empty.

Variables

View Source
var (
	TagOpen  = []byte("<menu")
	TagClose = []byte("</menu>")
)

Byte constants for HTML rendering.

Functions

func Items added in v0.3.0

func Items(items ...*li.Element) *element

Items creates a menu from li elements, enforcing correct nesting at compile time. Example: menu.Items(li.Text("Cut"), li.Text("Copy"), li.Text("Paste")) Renders: <menu><li>Cut</li><li>Copy</li><li>Paste</li></menu>

func New

func New(nodes ...node.Node) *element

New creates a new menu element with child li elements. Example: menu.New(li.Text("Cut"), li.Text("Copy"), li.Text("Paste")) Renders: <menu><li>Cut</li><li>Copy</li><li>Paste</li></menu>

Types

type Element

type Element = element

Element is an exported alias for the private element type

Jump to

Keyboard shortcuts

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