# Breadcrumb A "you are here" trail — a row of links showing how the user got to the current page. Like breadcrumbs leading back through a forest. --- ## Quick example ```csharp new Breadcrumb(new[] { ("Home", "/"), ("Settings", "/settings"), ("Profile", ""), // current page }) ``` The last item is always the current page. Its link is ignored — the component automatically renders it as plain text with full colour instead of a dimmed link. --- ## All the options ```csharp public Breadcrumb(IEnumerable<(string Label, string Href)> items) ``` | Parameter | What it does | |---|---| | `items` | An ordered list of `(Label, Href)` pairs from root to current page. | Two rules: - The **last item** is always rendered as plain text (current page). Its `Href` is ignored. - Any **non-last item** with an empty `Href` renders as a plain `` — useful for non-navigable category labels. --- ## Real-world examples ### Three-level app navigation ```csharp new Breadcrumb(new[] { ("Home", "/"), ("Reports", "/reports"), ("Monthly", ""), // current — href not needed }) ``` ### Built dynamically from a category tree ```csharp var crumbs = categoryPath .Select((cat, i) => (cat.Name, i < categoryPath.Count - 1 ? cat.Url : "")) .ToArray(); new Breadcrumb(crumbs) ``` ### Inside a page ```html
$$Breadcrumb$$

$$ArticleTitle$$

``` ```csharp // ArticlePage.htmx.cs public sealed class ArticlePage : ArticlePageBase { private readonly IHtmxComponent _breadcrumb; private readonly byte[] _titleData; public ArticlePage(string articleTitle, string categoryName, string categoryUrl) { _titleData = articleTitle.ToUtf8Bytes(); _breadcrumb = new Breadcrumb(new[] { ("Home", "/"), (categoryName, categoryUrl), (articleTitle, ""), }); } protected override void RenderBreadcrumb(HtmxRenderContext ctx) => _breadcrumb.Render(ctx.Next()); protected override void RenderArticleTitle(HtmxRenderContext ctx) => ctx.Writer.WriteUtf8(_titleData); } ``` --- ## How it works Each item renders as a `
  • ` inside an `
      ` inside a `