mirror of
https://github.com/imjasonh/html
synced 2026-07-14 12:25:24 +00:00
Initial commit
🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
commit
01c7432c71
72 changed files with 6192 additions and 0 deletions
37
generated_menu.go
Normal file
37
generated_menu.go
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
package html
|
||||
|
||||
// MenuElement represents the <menu> HTML element.
|
||||
|
||||
type MenuElement[C HTMLContent] basicElement[C]
|
||||
|
||||
|
||||
// Menu creates a new <menu> element.
|
||||
func Menu(children ...HTMLContent) *MenuElement[HTMLContent] {
|
||||
return &MenuElement[HTMLContent]{
|
||||
tagName: "menu",
|
||||
|
||||
content: children,
|
||||
}
|
||||
}
|
||||
|
||||
// Render returns the HTML string representation.
|
||||
func (e *MenuElement[C]) Render() string {
|
||||
return (*basicElement[C])(e).Render()
|
||||
}
|
||||
|
||||
// Attr sets an arbitrary attribute as an escape hatch.
|
||||
func (e *MenuElement[C]) Attr(key, value string) *MenuElement[C] {
|
||||
e.attributes = append(e.attributes, Attribute{Key: key, Value: value})
|
||||
return e
|
||||
}
|
||||
|
||||
|
||||
// Compact sets the compact attribute.
|
||||
func (e *MenuElement[C]) Compact(v bool) *MenuElement[C] {
|
||||
if v {
|
||||
e.attributes = append(e.attributes, Attribute{Key: "compact", Value: "compact"})
|
||||
}
|
||||
return e
|
||||
}
|
||||
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue