Documentation
¶
Overview ¶
Package nestedlist renders recursive <ul>/<ol> hierarchies with optional native <details> collapse on branches. Use it for navigation trees, settings menus, and multi-level outlines that don't need the lazy-load / RPC machinery of the tree pattern. Pure render — no runtime module.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var Style = registry.RegisterStyle("nestedlist", styleFn)
Style is the registered stylesheet handle. Render's top-level <ul>/<ol> goes through Style.WrapHTML so the data-fui-comp marker is emitted and the runtime auto-loads the CSS on first appearance. Apps no longer need to concatenate this package's CSS by hand.
Functions ¶
Types ¶
type Config ¶
type Config struct {
Items []Item
// Ordered renders the root list as <ol>. Nested lists inherit the
// same element type.
Ordered bool
// AriaLabel labels the wrapping list for assistive tech. Required
// for nav-style usage (settings menu, sidebar TOC).
AriaLabel string
ID string
Class string
}
Config configures the top-level wrapper.
type Item ¶
type Item struct {
// Label is the visible text. Required.
Label string
// Href turns a leaf node into a link. Branch nodes ignore Href —
// their summary is non-navigable on purpose so the disclosure
// trigger isn't ambiguous.
Href string
// Children, when non-empty, makes the item a collapsible branch.
Children []Item
// Expanded sets the initial open state on a branch node. Ignored
// for leaf nodes.
Expanded bool
// ID optionally tags this node for anchor links / scroll targets.
ID string
}
Item is one node in the list. A node with Children renders as a <details>/<summary>; a leaf node renders as a plain <li> (optionally wrapping its label in an <a> when Href is set).