Basic
import { html, renderApp } from 'mates';
import { Breadcrumbs } from 'mates-ui';
const App = () => () => html`
${Breadcrumbs({
items: [
{ label: "Home", href: "#" },
{ label: "Settings", href: "#" },
{ label: "Profile" },
],
})}
`;
renderApp(App, document.getElementById('app'));
With icons
import { html, renderApp } from 'mates';
import { Breadcrumbs } from 'mates-ui';
import { HomeIcon, FolderIcon, CodeIcon } from 'mates-icons';
const App = () => () => html`
${Breadcrumbs({
items: [
{ label: "Home", href: "#", icon: HomeIcon() },
{ label: "Projects", href: "#", icon: FolderIcon() },
{ label: "mates-ui", href: "#", icon: CodeIcon() },
{ label: "Components" },
],
})}
`;
renderApp(App, document.getElementById('app'));
Custom separator
import { html, renderApp } from 'mates';
import { Breadcrumbs } from 'mates-ui';
import { ChevronRightIcon } from 'mates-icons';
const App = () => () => html`
${Breadcrumbs({
items: [
{ label: "Dashboard", href: "#" },
{ label: "Users", href: "#" },
{ label: "Alice Johnson" },
],
separator: html`${ChevronRightIcon({ size: 14 })}`,
})}
`;
renderApp(App, document.getElementById('app'));
Collapsed with expand
import { html, atom, renderApp } from 'mates';
import { Breadcrumbs } from 'mates-ui';
const ITEMS = [
{ label: "Home", href: "#" },
{ label: "Workspace", href: "#" },
{ label: "Projects", href: "#" },
{ label: "mates", href: "#" },
{ label: "Packages", href: "#" },
{ label: "mates-ui" },
];
const App = () => {
const expanded = atom(false);
return () => html`
${expanded()
? Breadcrumbs({ items: ITEMS })
: Breadcrumbs({
items: ITEMS,
maxItems: 4,
trailingVisible: 2,
onExpand: () => expanded.set(true),
})}
`;
};
renderApp(App, document.getElementById('app'));
Sizes
import { html, renderApp } from 'mates';
import { Breadcrumbs } from 'mates-ui';
const ITEMS = [
{ label: "Home", href: "#" },
{ label: "Docs", href: "#" },
{ label: "API Reference" },
];
const App = () => () => html`
<x-col gap="var(--md-space-3)">
${Breadcrumbs({ items: ITEMS, size: "sm" })}
${Breadcrumbs({ items: ITEMS, size: "md" })}
${Breadcrumbs({ items: ITEMS, size: "lg" })}
</x-col>
`;
renderApp(App, document.getElementById('app'));