nav

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2026 License: MIT Imports: 2 Imported by: 0

README

Nav Component

Navigation menu with support for icons.

Import

"github.com/tinywasm/components/nav"

Usage

n := &nav.Nav{
    Items: []nav.NavItem{
        {Label: "Dashboard", Route: "dashboard", Icon: "icon-home"},
        {Label: "Settings", Route: "settings", Icon: "icon-cog"},
    },
}

Properties

  • Items ([]NavItem): List of navigation items.
    • Label (string): Display text.
    • Route (string): Target route/hash.
    • Icon (string): SVG sprite ID for icon (optional).

Back to Catalog

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NavLink(text, hash, icon string) *dom.Element

NavLink creates a navigation link with optional icon.

Types

type Nav struct {
	*dom.Element
	Items []NavItem
}
func (n *Nav) IconSvg() map[string]string
func (n *Nav) Render() *dom.Element
func (n *Nav) RenderCSS() string
type NavItem struct {
	Label string
	Route string // e.g., "users", "products"
	Icon  string // optional icon ID
}

Jump to

Keyboard shortcuts

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