Breadcrumbs
Breadcrumbs component with BreadcrumbList Microdata.
Structured Data for Breadcrumbs that produce a Rich Snippet (in this case breadcrumbs) in search results that are clickable, too!
https://schema.org/BreadcrumbList
Show back
<script setup>
import Breadcrumbs from 'spoko-design-system/src/components/Breadcrumbs.vue';
const trail = [
{ name: 'Level 1', path: '/level1' },
{ name: 'Level 2', path: '/level2' },
{ name: 'Level 3', path: '/level3' },
];
</script><Breadcrumbs
:breadcrumbs="trail"
suffix="6R0XXXXXX"
class="py-1 px-1 max-w-full flex bg-white"
show-back
text-back="Back"
/>Show home
<Breadcrumbs
:breadcrumbs="trail"
suffix="6R0XXXXXX"
class="py-1 px-1 max-w-full flex bg-white"
show-home
/>Simply
<Breadcrumbs
:breadcrumbs="trail"
suffix="6R0XXXXXX"
class="py-1 px-1 max-w-full flex bg-white"
/>Hide parts on mobile
Use hideOnMobile to hide selected parts below the sm breakpoint (640px); they
reappear from sm up. Accepted parts: 'suffix', 'home', 'separators', 'trail'.
It defaults to ['suffix'], so pass [] to show everything on mobile, or list more
parts to hide. Resize the preview below to see the suffix and separators come and go.
<Breadcrumbs
:breadcrumbs="trail"
suffix="6R0XXXXXX"
:hide-on-mobile="['suffix', 'separators']"
class="py-1 px-1 max-w-full flex bg-white"
/>Props
| Prop | Type | Default | Description |
|---|---|---|---|
breadcrumbs* | Array<{ name: string; path: string }> | — | Breadcrumb items — each needs name and path |
showBack | boolean | false | Show a back button before the breadcrumbs |
textBack | string | 'Back' | Label text for the back button |
showHome | boolean | false | Show home icon as first breadcrumb |
suffix | string | undefined | Text appended after the last breadcrumb — e.g. a product number |
titlePrefix | string | '' | Optional prefix prepended to each link title attribute — e.g. a brand name |
hideOnMobile | Array<'suffix' | 'home' | 'separators' | 'trail'> | ['suffix'] | Parts hidden below the sm breakpoint (restored from sm up). Defaults to hiding the suffix; pass [] to show everything on mobile |
withMicrodata | boolean | true | Include Schema.org BreadcrumbList markup — set false to avoid duplicates when rendering twice |
Microdata Control
When rendering breadcrumbs multiple times on the same page (e.g., mobile and desktop versions), use withMicrodata to prevent duplicate Schema.org markup:
<!-- Desktop version - WITH microdata (default) -->
<Breadcrumbs
breadcrumbs={[...]}
class="hidden md:block"
/>
<!-- Mobile version - WITHOUT microdata -->
<Breadcrumbs
breadcrumbs={[...]}
class="block md:hidden"
:withMicrodata="false"
/>
Schema support:
Example
| @type | BreadcrumbList |
|---|---|
| itemListElement | |
| @type | ListItem |
| name | Electrical, Lighting, Telematics |
| position | 1 |
| item | |
| @type | Thing |
| @id | https://catalog.polo.blue/electrical-lighting-telematics/ |
| itemListElement | |
| @type | ListItem |
| name | Exterior Lighting |
| position | 2 |
| item | |
| @type | Thing |
| @id | https://catalog.polo.blue/electrical-lighting-telematics/exterior-lighting/ |
| itemListElement | |
| @type | ListItem |
| name | Bulbs |
| position | 3 |
| item | |
| @type | Thing |
| @id | https://catalog.polo.blue/electrical-lighting-telematics/exterior-lighting/bulbs/ |
| itemListElement | |
| @type | ListItem |
| name | Bulb carrier with bulb; silver lens |
| position | 4 |