npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

ocsa-breadcrumb

v1.0.15

Published

A React breadcrumb component with TypeScript

Downloads

10

Readme

OCSA Breadcrumb

A lightweight and customizable React component for rendering accessible breadcrumb navigation in your web applications.

Features

  • Supports navigation hierarchy with optional links.
  • Accessible with proper ARIA attributes.
  • Customizable styling using external CSS.

Installation

Install the package via npm:

npm install ocsa-breadcrumb

Or with Yarn:

yarn add ocsa-breadcrumb

Usage

1. Import the Component and Styles

import React from "react";
import OcsaBreadcrumb from "ocsa-breadcrumb";

2. Provide Breadcrumb Items

The OcsaBreadcrumb component accepts an array of items representing your navigation hierarchy. Each item can include:

  • label: The text to display for the breadcrumb item.
  • href (optional): The URL the item links to. If omitted, the item is treated as plain text.
  • isCurrent (optional): Set true for the current page (last breadcrumb item).

3. Example Markup

Here’s how you can use the component in your React project:

import React from "react";
import OcsaBreadcrumb from "ocsa-breadcrumb";

const App = () => {
  const items = [
    { label: "Home", href: "/" },
    { label: "Library", href: "/library" },
    { label: "Data", href: "/data" },
    { label: "Bootstrap", href: "/bootstrap" },
    { label: "Product", isCurrent: true },
  ];

  return (
    <div>
      <OcsaBreadcrumb items={items} />
    </div>
  );
};

export default App;

Output

The component renders a breadcrumb navigation like this:

<nav aria-label="breadcrumb" class="breadcrumb">
  <ul>
    <li><a href="/">Home</a></li>
    <li><a href="/library">Library</a></li>
    <li><a href="/data">Data</a></li>
    <li><a href="/bootstrap">Bootstrap</a></li>
    <li><span aria-current="page">Product</span></li>
  </ul>
</nav>

Customization

Optional onClick Handler

The component allows for the inclusion of an 'onClick' handler. The return value is an item in the items array.

Here’s how you can use the component in your React project:

import React from "react";
import OcsaBreadcrumb from "ocsa-breadcrumb";

const App = () => {
  const handleOnClick = (item: BreadcrumbItem) => {
    console.log(item.label)
  }

  const items = [
    { label: "Home", href: "/" },
    { label: "Library", href: "/library" },
    { label: "Data", href: "/data" },
    { label: "Bootstrap", href: "/bootstrap" },
    { label: "Product", isCurrent: true },
  ];

  return (
    <div>
      <OcsaBreadcrumb items={items}  onClickHandler={onClickHandler} />
    </div>
  );
};

export default App;

NOTE: Including the onClicker handler will render the li elements with span elements rather than anchor elements.

Default Styles

Here’s a summary of the default CSS:

:root {
  --breadcrumb-color: red;
  --breadcrumb-content: "→";
}

.breadcrumb {
  padding: 0 0.5rem;
}

.breadcrumb a {
  color: var(--breadcrumb-link-color);
  text-decoration: none;
}

.breadcrumb ul {
  display: flex;
  flex-flow: row wrap;
  list-style: none;
  margin: 0;
  padding: 0;
  align-items: end;
}

.breadcrumb li:not(:last-child)::after {
  display: inline-block;
  margin: 0 0.25rem;
  content: var(--breadcrumb-content);
  color: var(--breadcrumb-color);
}

Overriding Styles

To customize, add your own CSS rules targeting the breadcrumb class or its children:

.breadcrumb li:not(:last-child)::after {
  content: ">";
  color: blue;
}

Accessibility

  • The aria-label="breadcrumb" attribute ensures the navigation is accessible.
  • The aria-current="page" attribute identifies the current page for screen readers.

Contributing

Contributions are welcome! If you encounter a bug or have a feature request, please open an issue or submit a pull request.

License

This package is licensed under the MIT License.