lightview
Version:
A reactive UI library with features of Bau, Juris, and HTMX plus safe LLM UI generation
344 lines (317 loc) • 18.1 kB
HTML
<!-- SEO-friendly SPA Shim -->
<script src="/lightview-router.js"></script>
<script>
if (globalThis.LightviewRouter) {
LightviewRouter.base('/index.html');
}
</script>
<!-- Load the page-specific stylesheet -->
<link rel="stylesheet" href="./index.css">
<!-- Gallery Structure -->
<div class="gallery-page">
<div class="gallery-layout">
<!-- Sidebar Overlay -->
<div id="sidebar-overlay" class="sidebar-overlay"></div>
<!-- Sidebar -->
<div id="gallery-sidebar" class="gallery-sidebar" style="visibility: hidden" src="./component-nav.html"></div>
<!-- Main Content -->
<div id="gallery-main" class="gallery-main">
<!-- Header Container -->
<div
style="position: sticky; top: 0; z-index: 30; background: var(--gallery-surface); border-bottom: 1px solid var(--gallery-border); backdrop-filter: blur(8px);">
<!-- Breadcrumbs Row -->
<div style="padding: 0.75rem 1.5rem 0;">
<script>
(() => {
const { Breadcrumbs } = Lightview.tags;
const breadcrumbs = Breadcrumbs({
id: 'page-breadcrumbs',
items: [
{ label: 'Components', href: '/docs/components' },
{ label: 'Breadcrumbs' }
]
});
document.currentScript.replaceWith(breadcrumbs.domEl);
})();
</script>
</div>
<!-- Title Row -->
<div class="gallery-header"
style="border-bottom: none; height: auto; padding-top: 0.5rem; padding-bottom: 0.75rem;">
<button id="toggle-btn" class="toggle-btn" aria-label="Toggle Sidebar">
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" class="toggle-icon"
style="stroke: currentColor; stroke-width: 2;">
<path stroke-linecap="round" stroke-linejoin="round" d="M15 19l-7-7 7-7" />
<path stroke-linecap="round" stroke-linejoin="round" d="M11 19l-7-7 7-7" />
</svg>
</button>
<h1 class="gallery-title">Breadcrumbs</h1>
</div>
</div>
<!-- Content -->
<div class="gallery-content">
<div class="section-content" style="max-width: 1000px;">
<p class="text-lg" style="opacity: 0.7; margin-bottom: 1.5rem;">
Breadcrumbs shows hierarchy and navigational path to the current page.
Supports icons and custom separators.
</p>
<!-- Basic Example with Examplify -->
<div class="card bg-base-200" style="margin-bottom: 2rem;">
<div class="card-body">
<h2 class="card-title">Basic Usage</h2>
<p class="text-sm" style="opacity: 0.7; margin-bottom: 1rem;">Navigation breadcrumb trail
with multiple
syntaxes.</p>
<!-- Tabs -->
<script>
globalThis.switchSyntaxTab = (tabId) => {
const tabs = ['tagged', 'vdom', 'object', 'html'];
tabs.forEach(t => {
const tabEl = document.getElementById(`tab-btn-${t}`);
const contentEl = document.getElementById(`syntax-${t}`);
if (t === tabId) {
tabEl.classList.add('syntax-tab-active');
contentEl.style.display = 'block';
} else {
tabEl.classList.remove('syntax-tab-active');
contentEl.style.display = 'none';
}
});
};
</script>
<div role="tablist" class="syntax-tabs" style="margin-bottom: 1rem;">
<button id="tab-btn-tagged" role="tab" class="syntax-tab syntax-tab-active"
onclick="switchSyntaxTab('tagged')">Tagged</button>
<button id="tab-btn-vdom" role="tab" class="syntax-tab"
onclick="switchSyntaxTab('vdom')">vDOM</button>
<button id="tab-btn-object" role="tab" class="syntax-tab"
onclick="switchSyntaxTab('object')">Object
DOM</button>
<button id="tab-btn-html" role="tab" class="syntax-tab"
onclick="switchSyntaxTab('html')">HTML</button>
</div>
<!-- Tagged Syntax -->
<div id="syntax-tagged">
<pre><script>
examplify(document.currentScript.nextElementSibling, {
at: document.currentScript.parentElement,
scripts: ['/lightview.js', '/lightview-x.js'],
styles: ['https://cdn.jsdelivr.net/npm/daisyui@3.9.4/dist/full.min.css'],
type: 'module',
minHeight: 75,
autoRun: true
});
</script><code contenteditable="true">await import('/components/navigation/breadcrumbs.js');
const { tags, $ } = Lightview;
const { Breadcrumbs } = tags;
const path = [
{ label: 'Home', href: '/' },
{ label: 'Products', href: '/products' },
{ label: 'Electronics', href: '/products/electronics' },
{ label: 'Phones' } // Current page (no href)
];
const breadcrumbs = Breadcrumbs({ style: 'font-size: 0.75rem' },
...path.map(item =>
item.href
? Breadcrumbs.Item({ href: item.href }, item.label)
: Breadcrumbs.Item({}, item.label)
)
);
$('#example').content(breadcrumbs);</code></pre>
</div>
<!-- vDOM Syntax -->
<div id="syntax-vdom" style="display: none;">
<pre><script>
examplify(document.currentScript.nextElementSibling, {
at: document.currentScript.parentElement,
scripts: ['/lightview.js', '/lightview-x.js'],
styles: ['https://cdn.jsdelivr.net/npm/daisyui@3.9.4/dist/full.min.css'],
type: 'module',
minHeight: 75
});
</script><code contenteditable="true">await import('/components/navigation/breadcrumbs.js');
const { $, tags } = Lightview;
const { Breadcrumbs } = tags;
const path = [
{ label: 'Home', href: '/' },
{ label: 'Products', href: '/products' },
{ label: 'Electronics', href: '/products/electronics' },
{ label: 'Phones' } // Current page (no href)
];
const breadcrumbs = {
tag: Breadcrumbs,
attributes: { style: 'font-size: 0.75rem' },
children: path.map(item => ({
tag: Breadcrumbs.Item,
attributes: item.href ? { href: item.href } : {},
children: [item.label]
}))
};
$('#example').content(breadcrumbs);</code></pre>
</div>
<!-- Object DOM Syntax -->
<div id="syntax-object" style="display: none;">
<pre><script>
examplify(document.currentScript.nextElementSibling, {
at: document.currentScript.parentElement,
scripts: ['/lightview.js', '/lightview-x.js'],
styles: ['https://cdn.jsdelivr.net/npm/daisyui@3.9.4/dist/full.min.css'],
type: 'module',
minHeight: 75
});
</script><code contenteditable="true">await import('/components/navigation/breadcrumbs.js');
const { $ } = Lightview;
const path = [
{ label: 'Home', href: '/' },
{ label: 'Products', href: '/products' },
{ label: 'Electronics', href: '/products/electronics' },
{ label: 'Phones' } // Current page (no href)
];
const breadcrumbs = {
Breadcrumbs: {
style: 'font-size: 0.75rem',
children: path.map(item => ({
'Breadcrumbs.Item': {
...(item.href ? { href: item.href } : {}),
children: [item.label]
}
}))
}
};
$('#example').content(breadcrumbs);</code></pre>
</div>
<!-- HTML Syntax -->
<div id="syntax-html" style="display: none;">
<pre><script>
examplify(document.currentScript.nextElementSibling, {
at: document.currentScript.parentElement,
scripts: ['/lightview.js', '/lightview-x.js'],
styles: ['https://cdn.jsdelivr.net/npm/daisyui@3.9.4/dist/full.min.css'],
type: 'module',
language: 'html',
minHeight: 75
});
</script><code contenteditable="true" class="language-html"><!-- Import the component (registers lv-breadcrumbs) -->
<script type="module" src="/components/navigation/breadcrumbs.js"></script>
<lv-breadcrumbs style="font-size: 0.75rem">
<lv-breadcrumbs-item href="/">Home</lv-breadcrumbs-item>
<lv-breadcrumbs-item href="/products">Products</lv-breadcrumbs-item>
<lv-breadcrumbs-item href="/products/electronics">Electronics</lv-breadcrumbs-item>
<lv-breadcrumbs-item>Phones</lv-breadcrumbs-item>
</lv-breadcrumbs></code></pre>
</div>
</div>
</div>
<!-- Props Table -->
<h2 class="text-xl font-bold" style="margin-bottom: 1rem;">Props</h2>
<div style="overflow-x: auto; margin-bottom: 2rem;">
<table class="table table-zebra">
<thead>
<tr>
<th>Prop</th>
<th>Type</th>
<th>Default</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>class</code></td>
<td>string</td>
<td>-</td>
<td>Additional classes (text-sm, text-lg)</td>
</tr>
</tbody>
</table>
</div>
<!-- Sub-components -->
<h2 class="text-xl font-bold" style="margin-bottom: 1rem;">Sub-components</h2>
<div style="overflow-x: auto; margin-bottom: 2rem;">
<table class="table table-zebra">
<thead>
<tr>
<th>Component</th>
<th>Props</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>Breadcrumbs.Item</code></td>
<td>href</td>
<td>Individual breadcrumb item</td>
</tr>
</tbody>
</table>
</div>
<!-- Custom Element Gallery -->
<h2 class="text-xl font-bold" style="margin-top: 2rem; margin-bottom: 1rem;">Breadcrumbs Gallery
</h2>
<p class="text-sm" style="opacity: 0.7; margin-bottom: 1.5rem;">
Live examples using <code><lv-breadcrumbs></code> and
<code><lv-breadcrumbs-item></code> custom elements.
</p>
<script type="module" src="/components/navigation/breadcrumbs.js"></script>
<!-- Basic -->
<h3 class="text-lg font-semibold" style="margin-bottom: 0.75rem;">Basic</h3>
<div style="margin-bottom: 2rem;">
<lv-breadcrumbs>
<lv-breadcrumbs-item href="/">Home</lv-breadcrumbs-item>
<lv-breadcrumbs-item href="/docs">Docs</lv-breadcrumbs-item>
<lv-breadcrumbs-item>Breadcrumbs</lv-breadcrumbs-item>
</lv-breadcrumbs>
</div>
<!-- With Icons -->
<h3 class="text-lg font-semibold" style="margin-bottom: 0.75rem;">With Icons</h3>
<div style="margin-bottom: 2rem;">
<lv-breadcrumbs>
<lv-breadcrumbs-item href="/">
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24"
class="w-4 h-4 mr-2 stroke-current">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
d="M3 7v10a2 2 0 002 2h14a2 2 0 002-2V9a2 2 0 00-2-2h-6l-2-2H5a2 2 0 00-2 2z">
</path>
</svg>
Home
</lv-breadcrumbs-item>
<lv-breadcrumbs-item href="/docs">
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24"
class="w-4 h-4 mr-2 stroke-current">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
d="M3 7v10a2 2 0 002 2h14a2 2 0 002-2V9a2 2 0 00-2-2h-6l-2-2H5a2 2 0 00-2 2z">
</path>
</svg>
Documents
</lv-breadcrumbs-item>
<lv-breadcrumbs-item>
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24"
class="w-4 h-4 mr-2 stroke-current">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
d="M9 13h6m-3-3v6m5 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z">
</path>
</svg>
Add Document
</lv-breadcrumbs-item>
</lv-breadcrumbs>
</div>
<!-- Sizes -->
<h3 class="text-lg font-semibold" style="margin-bottom: 0.75rem;">Sizes</h3>
<div style="display: flex; flex-direction: column; gap: 1rem; margin-bottom: 2rem;">
<lv-breadcrumbs class="text-xs">
<lv-breadcrumbs-item href="/">Home</lv-breadcrumbs-item>
<lv-breadcrumbs-item>Extra Small</lv-breadcrumbs-item>
</lv-breadcrumbs>
<lv-breadcrumbs class="text-sm">
<lv-breadcrumbs-item href="/">Home</lv-breadcrumbs-item>
<lv-breadcrumbs-item>Small</lv-breadcrumbs-item>
</lv-breadcrumbs>
<lv-breadcrumbs class="text-lg">
<lv-breadcrumbs-item href="/">Home</lv-breadcrumbs-item>
<lv-breadcrumbs-item>Large</lv-breadcrumbs-item>
</lv-breadcrumbs>
</div>
</div>
</div>
</div>
</div>
</div>