Documentation
¶
Overview ¶
Package tree provides a TreeView component built on the WAI-ARIA tree pattern. The Go-side renders the SSR-visible portion of the tree as nested <ul role="group">/<li role="treeitem"> elements. The runtime (core-ui/runtime/runtime.js) wires keyboard navigation — ArrowUp/Down/Left/Right, Home, End, Enter/Space, type-ahead — and drives expand/collapse through existing data-fui-rpc + signal machinery.
Children may be:
- Rendered statically up-front (Children populated).
- Lazy-loaded on expand (Children empty, LazyPath set). Pressing ArrowRight or Enter on a collapsed node clicks the node's toggle button (data-fui-tree-toggle), which fires an RPC to LazyPath. The server returns the inner HTML of the child <ul role="group">, swapped in via the signal binding.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var Style = registry.RegisterStyle("tree", styleFn)
Style is the registered stylesheet handle. CSS auto-loads on first appearance via the runtime's data-fui-comp scanner. Apps override the visual defaults via theme tokens.
Functions ¶
Types ¶
type Config ¶
type Config struct {
// ID is the wrapper id. Required.
ID string
// Label is the aria-label on the role="tree" wrapper. Required.
Label string
// Nodes are the root-level nodes. Required.
Nodes []Node
// SignalPrefix names the signal namespace used for lazy-load
// signal bindings — each LazyPath branch's child <ul role="group">
// is bound to data-fui-signal="<prefix>-<node-id>". Required when
// any node uses LazyPath; ignored otherwise.
SignalPrefix string
// Class is added to the tree wrapper.
Class string
}
Config configures the tree wrapper.
type Node ¶
type Node struct {
// ID is unique within the tree. Required.
ID string
// Label is the visible text. Required.
Label string
// Href, when set, makes the leaf label a link. Mutually
// exclusive with Children/LazyPath.
Href string
// Children are statically-known descendants. Empty for leaves.
Children []Node
// LazyPath, when set, makes this a branch whose children load
// on first expand via an RPC POST. Mutually exclusive with
// Children — if both are set, Children wins on first render and
// LazyPath is ignored (the children are already there).
LazyPath string
// Expanded forces this branch open on first paint. Default false.
Expanded bool
// Selected sets aria-selected="true" on the treeitem.
Selected bool
}
Node is one entry in the tree.
Click to show internal directories.
Click to hide internal directories.