5.24.1 • Published 9 months ago

@purpurds/breadcrumbs v5.24.1

Weekly downloads
-
License
AGPL-3.0-only
Repository
-
Last release
9 months ago

import { Meta, Stories, ArgTypes, Primary, Subtitle } from "@storybook/blocks";

import * as BreadcrumbsStories from "./src/breadcrumbs.stories"; import packageInfo from "./package.json";

Breadcrumbs

Version {packageInfo.version}

When a website has a lot of pages, breadcrumbs can help a user find their current location within the overal hierarchy. This page shows how you can make breadcrumbs accessible to all users.

Use them when you have several levels of navigation and want to make the parent pages available as navigation.

Accessibility

The Purpur breadcrumbs are accessible by default according to best practices. The last BreadcrumbsItem is the one belonging to the page the user is currently on.

Meta Data & SEO

Another benefit of helping the user find their way, is that we also help the search engines increasing understanding of our site.

By default, the breadcrumbs will render a JSON+LD script tag with structured meta data extracted from the breadcrumb items.

Custom Link Component

If you need a custom link, perhaps to use a router, like the next/link component, you can simply pass your custom link component and skip the href property on Breadcrumbs.Item, only passing it directly to <Link />.

Showcase

Properties

Installation

Via NPM

Add the dependency to your consumer app like "@purpurds/purpur": "^x.y.z"

In MyApp.tsx

import "@purpurds/purpur/styles";

In MyComponent.tsx

import { Breadcrumbs } from "@purpurds/purpur";

export const MyComponent = () => {
  return (
    <Breadcrumbs>
      <Breadcrumbs.Item href="/ships" onClick={() => console.log("clicking on ships")}>
        Ships
      </Breadcrumbs.Item>
      <Breadcrumbs.Item href="/ships/twin-seaters/">Twin Seaters</Breadcrumbs.Item>
      <Breadcrumbs.Item href="/ships/twin-seaters/naboo-n1">N1 Starfighter</Breadcrumbs.Item>
    </Breadcrumbs>
  );
};

Custom Link

With a custom link component such as next/link:

import { Breadcrumbs } from "@purpurds/breadcrumbs";
import Link from "next/link";

export const MyComponent = () => {
  return (
    <Breadcrumbs>
      <Breadcrumbs.Item>
        <Link href="/ships">Ships</Link>
      </Breadcrumbs.Item>
      <Breadcrumbs.Item>
        <Link href="/ships/twin-seaters">Twin Seaters</Link>
      </Breadcrumbs.Item>
      <Breadcrumbs.Item>
        <Link href="/ships/twin-seaters/naboo-n1">N1 Starfighter</Link>
      </Breadcrumbs.Item>
    </Breadcrumbs>
  );
};
5.24.1

9 months ago

5.24.0

9 months ago

5.23.0

9 months ago

5.21.1

9 months ago

5.21.0

9 months ago

5.22.0

9 months ago

5.18.3

10 months ago

5.18.2

10 months ago

5.18.1

10 months ago

5.18.0

10 months ago

5.19.1

9 months ago

5.19.0

9 months ago

5.17.0

10 months ago

5.20.1

9 months ago

5.20.0

9 months ago

5.16.1

10 months ago

5.16.0

10 months ago

5.15.1

10 months ago

5.15.0

10 months ago

5.14.0

11 months ago

5.5.0

1 year ago

5.3.0

1 year ago

5.1.2

1 year ago

5.13.0

11 months ago

5.11.2

11 months ago

5.11.1

11 months ago

5.11.0

11 months ago

5.8.2

1 year ago

5.8.1

1 year ago

5.8.0

1 year ago

5.4.3

1 year ago

5.6.0

1 year ago

5.4.2

1 year ago

5.4.1

1 year ago

5.4.0

1 year ago

5.2.0

1 year ago

5.12.0

11 months ago

5.10.1

11 months ago

5.10.0

12 months ago

5.9.0

1 year ago

5.7.0

1 year ago

5.1.1

1 year ago

5.1.0

1 year ago

5.0.0

1 year ago

4.5.0

1 year ago

4.6.0

1 year ago

4.5.1

1 year ago

4.4.0

1 year ago

4.3.0

1 year ago

4.2.0

1 year ago

4.1.1

1 year ago

4.1.0

1 year ago

4.0.2

1 year ago

4.0.1

1 year ago

4.0.0

1 year ago

3.7.1

1 year ago

3.7.0

1 year ago

3.6.0

1 year ago

3.5.1

1 year ago

3.5.0

1 year ago

3.4.0

1 year ago

3.3.2

1 year ago

3.3.1

1 year ago

3.3.0

1 year ago

3.2.0

1 year ago

3.1.0

1 year ago

3.0.1

1 year ago

3.0.0

1 year ago

2.8.0

1 year ago