mirror of
https://github.com/hunvreus/basecoat.git
synced 2026-11-12 21:28:18 +00:00
155 lines
8.2 KiB
Plaintext
155 lines
8.2 KiB
Plaintext
# Breadcrumb
|
|
|
|
<Preview>
|
|
<nav class="breadcrumb" aria-label="Breadcrumb">
|
|
<ol>
|
|
<li><a href="#">Home</a></li>
|
|
<li aria-hidden="true"><svg data-rtl-flip class="lucide lucide-chevron-right" xmlns="http://www.w3.org/2000/svg" width="24" height="24" 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></li>
|
|
<li><a href="#">Components</a></li>
|
|
<li aria-hidden="true"><svg data-rtl-flip class="lucide lucide-chevron-right" xmlns="http://www.w3.org/2000/svg" width="24" height="24" 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></li>
|
|
<li><span aria-current="page">Breadcrumb</span></li>
|
|
</ol>
|
|
</nav>
|
|
</Preview>
|
|
|
|
## Usage
|
|
|
|
<Steps>
|
|
<Step title="Include CSS">
|
|
|
|
Import Tailwind and one full Basecoat style bundle.
|
|
|
|
```css
|
|
@import "tailwindcss";
|
|
@import "basecoat-css/vega.css";
|
|
```
|
|
|
|
Or import only the base CSS, Breadcrumb component CSS, and one style pack.
|
|
|
|
```css
|
|
@import "tailwindcss";
|
|
@import "basecoat-css/base.css";
|
|
@import "basecoat-css/components/breadcrumb.css";
|
|
@import "basecoat-css/styles/vega.css";
|
|
```
|
|
|
|
Using CDN or bundler imports? See the [Installation page](/installation).
|
|
|
|
</Step>
|
|
<Step title="Add your breadcrumb HTML">
|
|
|
|
Use a navigation landmark with an ordered list. Mark the current page with `aria-current="page"`.
|
|
|
|
```html
|
|
<nav class="breadcrumb" aria-label="Breadcrumb">
|
|
<ol>
|
|
<li><a href="#">Home</a></li>
|
|
<li aria-hidden="true"><svg data-rtl-flip class="lucide lucide-chevron-right" ...></svg></li>
|
|
<li><span aria-current="page">Breadcrumb</span></li>
|
|
</ol>
|
|
</nav>
|
|
```
|
|
|
|
</Step>
|
|
</Steps>
|
|
|
|
## HTML structure
|
|
|
|
- `nav.breadcrumb` is the root landmark and should include `aria-label="Breadcrumb"`.
|
|
- `ol` contains the breadcrumb items in hierarchy order.
|
|
- `li > a` represents navigable ancestors.
|
|
- `li[aria-hidden="true"]` represents a visual separator.
|
|
- `[aria-current="page"]` represents the current page.
|
|
- `li > span[aria-hidden="true"]` represents a collapsed ellipsis.
|
|
|
|
## Examples
|
|
|
|
### Basic
|
|
|
|
<Preview>
|
|
<nav class="breadcrumb" aria-label="Breadcrumb">
|
|
<ol>
|
|
<li><a href="#">Home</a></li>
|
|
<li aria-hidden="true"><svg data-rtl-flip class="lucide lucide-chevron-right" xmlns="http://www.w3.org/2000/svg" width="24" height="24" 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></li>
|
|
<li><a href="#">Components</a></li>
|
|
<li aria-hidden="true"><svg data-rtl-flip class="lucide lucide-chevron-right" xmlns="http://www.w3.org/2000/svg" width="24" height="24" 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></li>
|
|
<li><span aria-current="page">Breadcrumb</span></li>
|
|
</ol>
|
|
</nav>
|
|
</Preview>
|
|
|
|
### Custom separator
|
|
|
|
<Preview>
|
|
<nav class="breadcrumb" aria-label="Breadcrumb">
|
|
<ol>
|
|
<li><a href="#">Home</a></li>
|
|
<li aria-hidden="true"><svg class="lucide lucide-dot" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12.1" cy="12.1" r="1" /></svg></li>
|
|
<li><a href="#">Components</a></li>
|
|
<li aria-hidden="true"><svg class="lucide lucide-dot" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12.1" cy="12.1" r="1" /></svg></li>
|
|
<li><span aria-current="page">Breadcrumb</span></li>
|
|
</ol>
|
|
</nav>
|
|
</Preview>
|
|
|
|
### Dropdown
|
|
|
|
<Preview>
|
|
<nav class="breadcrumb" aria-label="Breadcrumb">
|
|
<ol>
|
|
<li><a href="#">Home</a></li>
|
|
<li aria-hidden="true"><svg data-rtl-flip class="lucide lucide-chevron-right" xmlns="http://www.w3.org/2000/svg" width="24" height="24" 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></li>
|
|
<li>
|
|
<div id="breadcrumb-dropdown" class="dropdown-menu">
|
|
<button type="button" id="breadcrumb-dropdown-trigger" class="btn" data-variant="ghost" data-size="icon-sm" aria-haspopup="menu" aria-controls="breadcrumb-dropdown-menu" aria-expanded="false"><svg class="lucide lucide-ellipsis" xmlns="http://www.w3.org/2000/svg" width="24" height="24" 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>
|
|
<span class="sr-only">Toggle menu</span>
|
|
</button>
|
|
<div id="breadcrumb-dropdown-popover" data-popover aria-hidden="true">
|
|
<div role="menu" id="breadcrumb-dropdown-menu" aria-labelledby="breadcrumb-dropdown-trigger">
|
|
<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>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</li>
|
|
<li aria-hidden="true"><svg data-rtl-flip class="lucide lucide-chevron-right" xmlns="http://www.w3.org/2000/svg" width="24" height="24" 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></li>
|
|
<li><a href="#">Components</a></li>
|
|
<li aria-hidden="true"><svg data-rtl-flip class="lucide lucide-chevron-right" xmlns="http://www.w3.org/2000/svg" width="24" height="24" 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></li>
|
|
<li><span aria-current="page">Breadcrumb</span></li>
|
|
</ol>
|
|
</nav>
|
|
</Preview>
|
|
|
|
### Collapsed
|
|
|
|
<Preview>
|
|
<nav class="breadcrumb" aria-label="Breadcrumb">
|
|
<ol>
|
|
<li><a href="#">Home</a></li>
|
|
<li aria-hidden="true"><svg data-rtl-flip class="lucide lucide-chevron-right" xmlns="http://www.w3.org/2000/svg" width="24" height="24" 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></li>
|
|
<li> <span aria-hidden="true"><svg class="lucide lucide-ellipsis" xmlns="http://www.w3.org/2000/svg" width="24" height="24" 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></span></li>
|
|
<li aria-hidden="true"><svg data-rtl-flip class="lucide lucide-chevron-right" xmlns="http://www.w3.org/2000/svg" width="24" height="24" 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></li>
|
|
<li><a href="#">Components</a></li>
|
|
<li aria-hidden="true"><svg data-rtl-flip class="lucide lucide-chevron-right" xmlns="http://www.w3.org/2000/svg" width="24" height="24" 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></li>
|
|
<li><span aria-current="page">Breadcrumb</span></li>
|
|
</ol>
|
|
</nav>
|
|
</Preview>
|
|
|
|
### RTL
|
|
|
|
<Preview>
|
|
<nav class="breadcrumb" aria-label="Breadcrumb" dir="rtl">
|
|
<ol>
|
|
<li><a href="#">الرئيسية</a></li>
|
|
<li aria-hidden="true"><svg data-rtl-flip class="lucide lucide-chevron-right" xmlns="http://www.w3.org/2000/svg" width="24" height="24" 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></li>
|
|
<li><a href="#">المكونات</a></li>
|
|
<li aria-hidden="true"><svg data-rtl-flip class="lucide lucide-chevron-right" xmlns="http://www.w3.org/2000/svg" width="24" height="24" 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></li>
|
|
<li><span aria-current="page">مسار التنقل</span></li>
|
|
</ol>
|
|
</nav>
|
|
</Preview>
|