Breadcrumb
Trail of nav > ol > li links with automatic separators and an ellipsis mode for long paths. Current page via aria-current.
INSTALL
1pnpm dlx @sayagodev/mo add breadcrumbOr import the files from the package (no copy):
1import "@sayagodev/mo/css/breadcrumb.css";EXAMPLES
Basic
- Home
- Components
- Breadcrumb
1<nav aria-label="breadcrumb">2 <ol>3 <li><a href="#">Home</a></li>4 <li aria-hidden="true">5 <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="m9 18 6-6-6-6" /></svg>6 </li>7 <li><a href="#">Components</a></li>8 <li aria-hidden="true">9 <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="m9 18 6-6-6-6" /></svg>10 </li>11 <li><span aria-current="page">Breadcrumb</span></li>12 </ol>13</nav>14
With overflow menu
- Home
-
- Components
- Breadcrumb
1<nav aria-label="breadcrumb">2 <ol>3 <li><a href="#">Home</a></li>4 <li aria-hidden="true">5 <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="m9 18 6-6-6-6" /></svg>6 </li>7 <li>8 <mo-dropdown>9 <button type="button" class="ghost icon small" popovertarget="bc-demo-menu" aria-label="More">10 <span aria-hidden="true">11 <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="1" /><circle cx="19" cy="12" r="1" /><circle cx="5" cy="12" r="1" /></svg>12 </span>13 </button>14 <menu popover id="bc-demo-menu">15 <button role="menuitem" type="button">Documentation</button>16 <button role="menuitem" type="button">Themes</button>17 <button role="menuitem" type="button">GitHub</button>18 </menu>19 </mo-dropdown>20 </li>21 <li aria-hidden="true">22 <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="m9 18 6-6-6-6" /></svg>23 </li>24 <li><a href="#">Components</a></li>25 <li aria-hidden="true">26 <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="m9 18 6-6-6-6" /></svg>27 </li>28 <li><span aria-current="page">Breadcrumb</span></li>29 </ol>30</nav>31
With dropdown
- Home
-
- Breadcrumb
1<nav aria-label="breadcrumb">2 <ol>3 <li><a href="#">Home</a></li>4 <li aria-hidden="true">5 <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M22 2 2 22" /></svg>6 </li>7 <li>8 <mo-dropdown>9 <button type="button" class="ghost small" popovertarget="bc-dropdown">10 Components11 <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="m6 9 6 6 6-6" /></svg>12 </button>13 <menu popover id="bc-dropdown">14 <button role="menuitem" type="button">Documentation</button>15 <button role="menuitem" type="button">Themes</button>16 <button role="menuitem" type="button">GitHub</button>17 </menu>18 </mo-dropdown>19 </li>20 <li aria-hidden="true">21 <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M22 2 2 22" /></svg>22 </li>23 <li><span aria-current="page">Breadcrumb</span></li>24 </ol>25</nav>26
Collapsed (manual)
- Home
- Components
- Breadcrumb
1<nav aria-label="breadcrumb">2 <ol>3 <li><a href="#">Home</a></li>4 <li aria-hidden="true">5 <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="m9 18 6-6-6-6" /></svg>6 </li>7 <li>8 <span aria-hidden="true">9 <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="1" /><circle cx="19" cy="12" r="1" /><circle cx="5" cy="12" r="1" /></svg>10 <span class="sr-only">More</span>11 </span>12 </li>13 <li aria-hidden="true">14 <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="m9 18 6-6-6-6" /></svg>15 </li>16 <li><a href="#">Components</a></li>17 <li aria-hidden="true">18 <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="m9 18 6-6-6-6" /></svg>19 </li>20 <li><span aria-current="page">Breadcrumb</span></li>21 </ol>22</nav>23
Collapsed (auto)
- Home
- Docs
- Components
- Breadcrumb
- Settings
- Collapsed
1<nav aria-label="breadcrumb" data-collapsed>2 <ol>3 <li><a href="#">Home</a></li>4 <li aria-hidden="true">5 <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="m9 18 6-6-6-6" /></svg>6 </li>7 <li><a href="#">Docs</a></li>8 <li aria-hidden="true">9 <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="m9 18 6-6-6-6" /></svg>10 </li>11 <li><a href="#">Components</a></li>12 <li aria-hidden="true">13 <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="m9 18 6-6-6-6" /></svg>14 </li>15 <li><a href="#">Breadcrumb</a></li>16 <li aria-hidden="true">17 <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="m9 18 6-6-6-6" /></svg>18 </li>19 <li><a href="#">Settings</a></li>20 <li aria-hidden="true">21 <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="m9 18 6-6-6-6" /></svg>22 </li>23 <li><span aria-current="page">Collapsed</span></li>24 </ol>25</nav>26 27<!-- Sin data-collapsed sería una tira larga de 6 niveles.28 Con data-collapsed en nav u ol, los items intermedios se ocultan29 automáticamente y aparece "…" generado por CSS (sin JS). -->30
Link
- Home
- Components
- Breadcrumb
1<nav aria-label="breadcrumb">2 <ol>3 <li><a href="#link-component">Home</a></li>4 <li aria-hidden="true">5 <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="m9 18 6-6-6-6" /></svg>6 </li>7 <li><a href="#link-component">Components</a></li>8 <li aria-hidden="true">9 <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="m9 18 6-6-6-6" /></svg>10 </li>11 <li><span aria-current="page">Breadcrumb</span></li>12 </ol>13</nav>14
Custom separator
- Home
- Components
- Breadcrumb
1<nav aria-label="breadcrumb">2 <ol>3 <li><a href="#">Home</a></li>4 <li aria-hidden="true">5 <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M22 2 2 22" /></svg>6 </li>7 <li><a href="#">Components</a></li>8 <li aria-hidden="true">9 <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M22 2 2 22" /></svg>10 </li>11 <li><span aria-current="page">Breadcrumb</span></li>12 </ol>13</nav>14
RTL
1<nav aria-label="breadcrumb" dir="rtl">2 <ol>3 <li><a href="#">الرئيسية</a></li>4 <li aria-hidden="true">5 <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="m9 18 6-6-6-6" /></svg>6 </li>7 <li><a href="#">المكونات</a></li>8 <li aria-hidden="true">9 <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="m9 18 6-6-6-6" /></svg>10 </li>11 <li><span aria-current="page">مسار التنقل</span></li>12 </ol>13</nav>14
USAGE
1<nav aria-label="breadcrumb">2 <ol>3 <li><a href="#">Home</a></li>4 <li aria-hidden="true"><svg …chevron… /></li>5 <li><a href="#">Components</a></li>6 <li aria-hidden="true"><svg … /></li>7 <li><span aria-current="page">Breadcrumb</span></li>8 </ol>9</nav>10 11<!-- collapsed (auto): add data-collapsed to nav or ol -->12<nav aria-label="breadcrumb" data-collapsed>13 <ol>14 <li><a href="#">Home</a></li>15 ... many items ...16 <li><span aria-current="page">Current</span></li>17 </ol>18</nav>19 20<!-- collapsed (manual fallback) -->21<li><span aria-hidden="true"><svg …more… /><span class="sr-only">More</span></span></li>22 23<!-- dropdown: trigger uses button ghost -->24<mo-dropdown><button class="ghost small" popovertarget="m">Components <svg …chevron-down… /></button><menu popover id="m">…</menu></mo-dropdown>
API
NAMEKINDDESCRIPTION
nav[aria-label="breadcrumb"]elementRoot nav landmark
olelementFlex wrap gap-1.5 sm:gap-2.5 text-sm muted break-words
lielementInline-flex gap-1.5
aelementMuted, transition-colors hover:text-foreground
li[aria-hidden="true"]elementSeparator, [&>svg]:size-3.5; presence opts out of auto-slash
[aria-current="page"]attributeCurrent page: foreground font-normal
span[aria-hidden]elementEllipsis: flex size-9 center svg size-4, .sr-only More (manual)
[data-collapsed]attributeAuto-collapsed: on nav or ol hides middle li and injects "…" (also data-ellipsis/data-truncated aliases)
.sr-onlyclassShared visually-hidden (in shared.css)
FILES
src/css/breadcrumb.cssInstall:
mo add breadcrumbTHEMING · PLAYGROUND
This is the exact component from the examples above, wearing a completely different theme. Edit the tokens and --mo-* hooks in the editor — autocomplete knows them all — and the preview obeys in real time. Your CSS always wins.
Global tokens
--foreground--muted-foreground--radiusPreview
Your CSS
Try it: type --mo- for the component hooks, or edit any value — the preview obeys in real time.