breadcrumbs

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Jun 8, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package breadcrumbs renders an ARIA-correct breadcrumb trail.

Output structure:

<nav aria-label="Breadcrumb">
  <ol class="breadcrumbs">
    <li><a href="/">Home</a></li>
    <li><a href="/docs/">Docs</a></li>
    <li><span aria-current="page">Components</span></li>
  </ol>
</nav>

The last crumb (with empty Href OR Current=true) renders as a <span> with aria-current="page". Separators are CSS-driven (no extra DOM).

Index

Constants

This section is empty.

Variables

View Source
var Style = registry.RegisterStyle("breadcrumbs", styleFn)

Style is the registered stylesheet handle. New's <nav> goes through Style.WrapHTML so the data-fui-comp marker is emitted and the runtime auto-loads the CSS on first appearance.

Functions

func New

func New(cfg Config, crumbs ...Crumb) render.HTML

New renders the breadcrumb trail.

Panics if no crumbs are provided.

Types

type Config

type Config struct {
	Label string // optional aria-label for the <nav>; defaults to "Breadcrumb"
	ID    string
	Class string
}

Config configures the breadcrumb nav element.

type Crumb

type Crumb struct {
	Text string
	Href string // empty → renders as the current/last crumb
	// Current overrides the empty-Href heuristic: set true on a Crumb
	// with a Href if you want it marked aria-current="page" anyway
	// (e.g. the page itself appearing in its own trail with a link).
	Current bool
}

Crumb is one step in the breadcrumb trail.

Jump to

Keyboard shortcuts

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