Log inGet started
World

Builtin Library

Branchmain
Branchesmainpublish
Commitdd348ac6c3

README.md

breadcrumb

Breadcrumb path widget — renders /zero/runtime/scenes/... as a row of clickable segments. Each segment emits a callback id carrying the absolute path up to and including that segment, so a single router rule reaches every navigation target. Stateless — caller passes the current absolute path and a callback prefix; receives a hbox.

Exports

  • breadcrumb(path: string, opts: BreadcrumbOpts?) -> WidgetNode — build a hbox of breadcrumb segments. Home (⌂) segment always renders first; each /-delimited segment renders as a button whose callback id is <onNavigate>-<absolute-path>.

Types:

  • BreadcrumbOpts = { id: string?, onNavigate: string? }
  • WidgetNode = { [string]: any }

Usage

local Z = require("@builtin::modules.zui")

local crumb = Z.fs.breadcrumb("/zero/runtime/scenes/", {
    onNavigate = "files-nav",
})

app:on("^files%-nav%-(.+)$", function(_v, _id, path)
    state.currentPath = path
end)

Notes

  • Stateless. No state ownership, no engine calls beyond the widget primitives.
  • A trailing slash on the input path is stripped before splitting unless the whole input is /.
  • The home crumb's callback id is <onNavigate>-/ so a single router rule (^files%-nav%-(.+)$) covers root too.