Skip to content
VinUIComponentsBreadcrumb

Breadcrumb

The trail of pages above this one, so people can see where they are and go back up. Same markup and props in every style: switch the style in the header to see it change.

Basic

Links up the trail; the current page is plain text.

Chevron

A chevron between items instead of a slash.

Long names

Names longer than 22 characters are cut with an ellipsis; the full name is in the title attribute.

Installation

React, Vue and Svelte: add the component to your project with the CLI. It reads your framework from vin.json and also copies any component this one needs. Then import it:

Terminal
npx @vinish/ui add breadcrumb
React
import { Breadcrumb } from "@/components/vin/breadcrumb";
Vue
import Breadcrumb from "@/components/vin/breadcrumb.vue";
Svelte
import Breadcrumb from "$lib/components/vin/breadcrumb.svelte";

The import paths assume the default folders: @/components/vin (React and Vue, with the usual @ → src alias) and $lib/components/vin (SvelteKit). Use your own if you chose another folder in init. How the Vue and Svelte versions pass values and content is in Frameworks.

Plain HTML: the classes come with the style's stylesheet. It needs no JavaScript.

API

From spec/breadcrumb.json, which every framework version is tested against.

PropValuesDefaultIn HTML
items
The trail, top first. The last item is this page (no href).
{ label, href? }[]—li > a.vin-breadcrumb__link, last li > span.vin-breadcrumb__page[aria-current=page]
separatorslashchevronslashvin-breadcrumb--chevron

Parts

React, Vue, SvelteHTML classes
<Breadcrumb>.vin-breadcrumb.vin-breadcrumb--chevron.vin-breadcrumb__list.vin-breadcrumb__item.vin-breadcrumb__link.vin-breadcrumb__page

Accessibility

  • A <nav> named "Breadcrumb", with an ordered list inside, so screen readers announce a breadcrumb landmark and the number of levels.
  • The current page has aria-current="page".
  • The separators are drawn by CSS with empty alternative text, so they aren't read out.