Documentation
¶
Overview ¶
Package menu provides menu and navigation components following shadcn/ui patterns. Menu components support icons, badges, and active states.
Index ¶
- func Item(href string, label g.Node, opts ...ItemOption) g.Node
- func Menu(children ...g.Node) g.Node
- func MenuWithOptions(opts []MenuOption, children ...g.Node) g.Node
- func Section(label string, children ...g.Node) g.Node
- func SectionWithOptions(label string, opts []SectionOption, children ...g.Node) g.Node
- func Separator() g.Node
- type ItemOption
- type ItemProps
- type MenuOption
- type MenuProps
- type SectionOption
- type SectionProps
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Item ¶
Item creates a menu item (link or button)
Example:
menu.Item("/dashboard", g.Text("Dashboard"), menu.Active(), menu.WithIcon(icon))
func Menu ¶
Menu creates a vertical navigation menu
Example:
menu.Menu(
menu.Item("/", g.Text("Home"), menu.Active()),
menu.Item("/about", g.Text("About")),
)
func MenuWithOptions ¶
func MenuWithOptions(opts []MenuOption, children ...g.Node) g.Node
MenuWithOptions creates menu with custom options
func Section ¶
Section creates a grouped menu section with label
Example:
menu.Section("Main",
menu.Item("/", g.Text("Home")),
menu.Item("/about", g.Text("About")),
)
func SectionWithOptions ¶
SectionWithOptions creates section with custom options
Types ¶
type ItemOption ¶
type ItemOption func(*ItemProps)
ItemOption is a functional option for configuring menu items
func WithItemAttrs ¶
func WithItemAttrs(attrs ...g.Node) ItemOption
WithItemAttrs adds custom attributes to item
func WithItemClass ¶
func WithItemClass(class string) ItemOption
WithItemClass adds custom classes to item
func WithVariant ¶
func WithVariant(variant string) ItemOption
WithVariant sets the menu item variant
type ItemProps ¶
type ItemProps struct {
Href string
Active bool
Icon g.Node
Badge g.Node
Variant string // "default", "ghost"
Class string
Attrs []g.Node
}
ItemProps defines menu item configuration
type MenuOption ¶
type MenuOption func(*MenuProps)
MenuOption is a functional option for configuring menus
func WithAttrs ¶
func WithAttrs(attrs ...g.Node) MenuOption
WithAttrs adds custom attributes to menu
type SectionOption ¶
type SectionOption func(*SectionProps)
SectionOption is a functional option for configuring menu sections
func WithSectionAttrs ¶
func WithSectionAttrs(attrs ...g.Node) SectionOption
WithSectionAttrs adds custom attributes to section
func WithSectionClass ¶
func WithSectionClass(class string) SectionOption
WithSectionClass adds custom classes to section