Breadcrumb

Counted Trail

A trail carrying a record count per level: a section with three products and one with a thousand are different decisions.

  • breadcrumb
  • counts
  • catalog
  • navigation

Preview

1440pxHost theme

Use it with AI

  1. 1. Copy the link.
  2. 2. Write to your agent in your own words and drop the link into the sentence.
  3. 3. The agent opens the link and installs the component from the registry.

put this in the header: https://vibeui.ru/c/breadcrumb-010?lang=en

Show the full instructions

What the link says, spelled out. Use it when your agent cannot open links — paste this text instead.

# Install and place "breadcrumb-010" (Counted Trail) from VibeUI

## 1. Install first — do not skip, do not recreate
Run this exact command before writing any code:
npx shadcn@latest add https://vibeui.ru/r/breadcrumb-010.json

Registry item: https://vibeui.ru/r/breadcrumb-010.json
Installs to: components/vibeui/breadcrumb-010.tsx (the exact path follows this project's components.json aliases).
npm dependencies: none.
Registry dependencies: none.

Install it from the registry. Do not recreate it from the description,
do not substitute a similar component from another library, and do not
rewrite it to match the project's existing style.

## 2. What it is
A trail carrying a record count per level: a section with three products and one with a thousand are different decisions.

Breadcrumbs with a per-level count: the counter sits inside the link, uses tabular figures and carries a worded label for screen readers. Zero dependencies, one file, no client JS.

## 3. How to use it
import { Breadcrumb010 } from "@/components/vibeui/breadcrumb-010"

<Breadcrumb010 items={[{ label: "Catalog", href: "/", count: 1280 }]} />

Read the installed file for the full prop list.

## 4. Where to place it
This is a small inline component. Put it exactly where the user asked,
inside the existing markup. Do not create a new page, section or
wrapper for it. If a similar control already sits in that spot,
replace it instead of adding a second one.

Placement: ___
(The user fills this line in. If it is still blank, ask where to put it
instead of guessing.)

## 5. Keep exactly as installed
- the local --vibeui-breadcrumb-010-* palette — do not swap it for your theme tokens
- the counter inside the link: outside it separates from the label on wrap
- the worded aria-label on the counter — a bare number means nothing aloud
- tabular figures so numbers do not jitter the line
- the muted counter: it qualifies the level, it does not compete with it
- the border-drawn chevron separator

## 6. You may change
- the items array with its count field
- the accent through the accent prop
- number formatting in the caller
- the counter's colour and background

## 7. Rules
- Format numbers upstream: the component prints what it is given and adds no separators.
- Counting every level is expensive: if the count is approximate, better not to show it.
- A count on the current level helps; on the root it is usually noise — leave it out.
- Do not lift the CSS variables into globals.css: the component has to stay a single file.

## 8. Verify
- it renders with no console errors;
- it looks like the preview on the VibeUI page you copied this from;
- if it does not, you changed something listed in section 5 — put it back.

For developers

npx shadcn@latest add https://vibeui.ru/r/breadcrumb-010.json
https://vibeui.ru/r/breadcrumb-010.json

Компонент самодостаточен: один файл, без зависимостей, собственная палитра в локальных переменных --vibeui-breadcrumb-010-*. Серверный: хуков нет. Счётчик лежит внутри ссылки уровня, а не рядом с ней, поэтому не отрывается при переносе строки. Цифры табличные, у счётчика собственный aria-label со словами: голая цифра в потоке речи не читается.

Component source

The same file your agent installs. Here in case you would rather copy it by hand.

import type { ComponentPropsWithoutRef, CSSProperties } from "react"

export type Breadcrumb010Item = {
  label: string
  href?: string
  count?: number
}

export type Breadcrumb010Props = Omit<
  ComponentPropsWithoutRef<"nav">,
  "children"
> & {
  items?: Breadcrumb010Item[]
  accent?: string
}

// Идея компонента: путь с числом записей на каждом уровне. Число отвечает
// на вопрос «стоит ли туда возвращаться»: раздел с тремя товарами и раздел
// с тысячей — разные решения. Оно приписано к уровню, а не висит отдельной
// плашкой, и уходит скринридеру словами, а не голой цифрой.
const STYLES = `
:where([data-vibeui-block="breadcrumb-010"]){
--vibeui-breadcrumb-010-surface:oklch(1 0 0);
--vibeui-breadcrumb-010-surface-border:oklch(0.91 0.006 265);
--vibeui-breadcrumb-010-fg:oklch(0.26 0.016 265);
--vibeui-breadcrumb-010-muted:oklch(0.56 0.014 265);
--vibeui-breadcrumb-010-chip:oklch(0.95 0.005 265);
--vibeui-breadcrumb-010-accent:oklch(0.55 0.17 265);
--vibeui-breadcrumb-010-font:ui-sans-serif,system-ui,-apple-system,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif;
}
/* Собственная подложка: крошки — это текст, и на тёмной странице
   он обязан читаться без правки палитры проекта. */
[data-vibeui-block="breadcrumb-010"]{
box-sizing:border-box;padding:0.5rem 0.75rem;
background:var(--vibeui-breadcrumb-010-surface);
border:1px solid var(--vibeui-breadcrumb-010-surface-border);border-radius:0.625rem;
font-family:var(--vibeui-breadcrumb-010-font);font-size:0.8125rem;line-height:1.4;
color:var(--vibeui-breadcrumb-010-muted);
}
[data-vibeui-block="breadcrumb-010"] ol{
display:flex;flex-wrap:wrap;align-items:center;gap:0.4375rem;
margin:0;padding:0;list-style:none;
}
[data-vibeui-block="breadcrumb-010"] li{display:inline-flex;align-items:center;gap:0.4375rem}
[data-vibeui-block="breadcrumb-010"] li + li::before{
content:"";width:0.3125rem;height:0.3125rem;
border-top:1.5px solid oklch(0.78 0.01 265);
border-right:1.5px solid oklch(0.78 0.01 265);
transform:rotate(45deg);
}
[data-vibeui-block="breadcrumb-010"] a,
[data-vibeui-block="breadcrumb-010"] [aria-current="page"]{
display:inline-flex;align-items:center;gap:0.3125rem;
color:inherit;text-decoration:none;border-radius:0.25rem;
}
[data-vibeui-block="breadcrumb-010"] a:hover{color:var(--vibeui-breadcrumb-010-fg)}
[data-vibeui-block="breadcrumb-010"] a:focus-visible{outline:2px solid var(--vibeui-breadcrumb-010-accent);outline-offset:2px}
[data-vibeui-block="breadcrumb-010"] [aria-current="page"]{color:var(--vibeui-breadcrumb-010-fg);font-weight:600}
/* Число приписано к уровню: отдельная плашка оторвалась бы от названия. */
[data-vibeui-block="breadcrumb-010"] [data-part="count"]{
display:inline-flex;align-items:center;height:1.0625rem;padding:0 0.3125rem;
border-radius:9999px;background:var(--vibeui-breadcrumb-010-chip);
font-size:0.6875rem;font-weight:600;font-variant-numeric:tabular-nums;
color:var(--vibeui-breadcrumb-010-muted);
}
@media (prefers-reduced-motion:reduce){[data-vibeui-block="breadcrumb-010"] *{animation:none!important;transition:none!important}}
`

const DEFAULT_ITEMS: Breadcrumb010Item[] = [
  { label: "Каталог", href: "#", count: 1280 },
  { label: "Электроника", href: "#", count: 342 },
  { label: "Наушники", count: 27 },
]

/**
 * Путь с числом записей на каждом уровне.
 * Один файл, ноль зависимостей, собственная палитра.
 */
export function Breadcrumb010({
  items = DEFAULT_ITEMS,
  accent,
  className,
  style,
  ...props
}: Breadcrumb010Props) {
  const palette = {
    ...(accent ? { "--vibeui-breadcrumb-010-accent": accent } : null),
    ...style,
  } as CSSProperties

  return (
    <>
      <style href="vibeui-breadcrumb-010" precedence="medium">
        {STYLES}
      </style>
      <nav
        {...props}
        data-vibeui-block="breadcrumb-010"
        aria-label="Хлебные крошки"
        className={className}
        style={palette}
      >
        <ol>
          {items.map((item, index) => {
            const last = index === items.length - 1
            const count =
              item.count === undefined ? null : (
                <span
                  data-part="count"
                  aria-label={`${item.count} записей в разделе`}
                >
                  {item.count}
                </span>
              )

            return (
              <li key={item.label}>
                {item.href && !last ? (
                  <a href={item.href}>
                    {item.label}
                    {count}
                  </a>
                ) : (
                  <span aria-current={last ? "page" : undefined}>
                    {item.label}
                    {count}
                  </span>
                )}
              </li>
            )
          })}
        </ol>
      </nav>
    </>
  )
}