Files
basecoat/docs/src/components/breadcrumb.njk
T

76 lines
2.5 KiB
Plaintext
Raw Normal View History

2025-04-25 16:42:10 +08:00
---
2025-05-01 12:50:40 +08:00
layout: layouts/page.njk
2025-04-25 16:42:10 +08:00
title: Breadcrumb
description: Displays the path to the current resource using a hierarchy of links.
toc:
- label: Usage
id: usage
---
2025-04-25 21:23:11 +08:00
{% from "macros/code_preview.njk" import code_preview %}
{% from "macros/code_block.njk" import code_block %}
2025-05-01 20:53:03 +08:00
{% from "dropdown-menu.njk" import dropdown_menu %}
2025-04-25 21:23:11 +08:00
2025-04-25 16:42:10 +08:00
<div class="alert mb-6">
{% lucide "circle-alert" %}
<h2>There is no dedicated breadcrumb component in Basecoat.</h2>
</div>
2025-04-29 19:14:31 +08:00
{% set code_script %}
2025-05-01 20:53:03 +08:00
<script>
{% fetchCode "src/js/dropdown-menu.js" %}
document.addEventListener('alpine:init', () => {
window.basecoat.registerDropdownMenu(Alpine);
});
</script>
2025-04-29 19:14:31 +08:00
{% endset %}
{% set code_html %}
<ol class="text-muted-foreground flex flex-wrap items-center gap-1.5 text-sm break-words sm:gap-2.5">
2025-04-25 16:42:10 +08:00
<li class="inline-flex items-center gap-1.5">
<a href="#" class="hover:text-foreground transition-colors">Home</a>
</li>
<li>{% lucide "chevron-right", { "class": "size-3.5" } %}</li>
<li class="inline-flex items-center gap-1.5">
{% set trigger %}
{% lucide "ellipsis" %}
{% endset %}
{% call dropdown_menu(
id="demo-breadcrumb-menu",
trigger=trigger,
2025-04-26 11:59:53 +08:00
trigger_attrs={"class": "flex size-9 items-center justify-center h-4 w-4 hover:text-foreground cursor-pointer"},
register_on=["alpine:init", "htmx:afterSwap"]
2025-04-25 16:42:10 +08:00
) %}
<nav role="menu">
<button type="button" role="menuitem">Documentation</button>
<button type="button" role="menuitem">Themes</button>
<button type="button" role="menuitem">GitHub</button>
</nav>
{% endcall %}
</li>
<li>{% lucide "chevron-right", { "class": "size-3.5" } %}</li>
<li class="inline-flex items-center gap-1.5">
<a href="#" class="hover:text-foreground transition-colors">Components</a>
</li>
<li>{% lucide "chevron-right", { "class": "size-3.5" } %}</li>
<li class="inline-flex items-center gap-1.5">
<span class="text-foreground font-normal">Breadcrumb</span>
</li>
2025-04-29 19:14:31 +08:00
</ol>
{% endset %}
{{ code_preview("dropdown-menu", code_script | prettyHtml ~ code_html | prettyHtml) }}
2025-04-25 16:42:10 +08:00
<h2 id="usage"><a href="#usage">Usage</a></h2>
2025-05-01 20:53:03 +08:00
<section class="prose">
2025-04-27 23:19:52 +08:00
<p>The example above uses some simple Tailwind CSS along with the <a href="/components/dropdown-menu">Dropdown Menu</a>.</p>
2025-04-25 21:23:11 +08:00
</section>
2025-05-01 20:53:03 +08:00
{% from "tabs.njk" import tabs %}
2025-04-29 19:14:31 +08:00
{% set tabsets = [
2025-05-01 20:53:03 +08:00
{ tab: "HTML", panel: code_block(code_html | prettyHtml, class="") },
{ tab: "Javascipt (Alpine.js)", panel: code_block(code_script | prettyHtml, class="") }
2025-04-29 19:14:31 +08:00
] %}
{{ tabs(id="alert-dialog", tabsets=tabsets) }}