Bar breadcrumbs
Five breadcrumbs that vary the container instead of the trail: a full-width bar, a rounded card, a bare outline, a filled secondary surface and a sticky bar that pins to the top of a scrolling region. Each is sized, token-driven and marks the current page with aria-current.
Installation
The styled layer is free and installs like any other ai2 component.
Run the following command
npx shadcn@latest add @ai2/breadcrumb-barDependencies, the @ai2/tokens theme and the component file are installed together.
Install dependencies
npm install lucide-reactCopy the source
components/ui/breadcrumb-bar.tsx"use client"
import type * as React from "react"
import { ChevronRight } from "lucide-react"
import { cn } from "@/lib/utils"
/* Bar breadcrumb family: 5 contained surfaces. The trail and the separator are always the same; what changes is the container wrapping the trail (a full-width lined bar, a rounded card, a border only, a solid secondary surface, a sticky bar that stays on top while scrolling). Colour comes ONLY from tokens (alpha via color-mix), the size is a text scale plus gap plus height. The last item is the current page (aria-current), not a link. Deterministic, no motion. */
export type StyledSize = "sm" | "md" | "lg" | "xl"
type Crumb = { label: React.ReactNode; href?: string }
type Props = {
className?: string
size?: StyledSize
items?: Crumb[]
}
const trail: Record<StyledSize, string> = {
sm: "gap-1.5 text-xs",
md: "gap-2 text-sm",
lg: "gap-2.5 text-sm",
xl: "gap-3 text-base",
}
const box: Record<StyledSize, string> = {
sm: "min-h-8 px-2.5 py-1.5",
md: "min-h-9 px-3 py-2",
lg: "min-h-10 px-4 py-2.5",
xl: "min-h-12 px-5 py-3",
}
const radius: Record<StyledSize, string> = {
sm: "rounded-md",
md: "rounded-lg",
lg: "rounded-lg",
xl: "rounded-xl",
}
const defaultItems: Crumb[] = [
{ label: "Home", href: "#" },
{ label: "Components", href: "#" },
{ label: "Button" },
]
const link =
"inline-flex items-center gap-1.5 rounded-sm text-muted-foreground transition-colors hover:text-foreground focus-visible:outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50 [&_svg]:size-3.5 [&_svg]:shrink-0 [&_i]:text-sm [&_i]:leading-none"
const current =
"inline-flex items-center gap-1.5 font-medium text-foreground [&_svg]:size-3.5 [&_svg]:shrink-0 [&_i]:text-sm [&_i]:leading-none"
const sep =
"flex items-center text-muted-foreground/60 [&>svg]:size-3.5 [&>svg]:shrink-0 [&>i]:text-sm [&>i]:leading-none"
/* Shared shell: barClassName carries each variant's container technique. */
function BarTrail({
className,
size = "md",
items,
barClassName,
}: Props & { items: Crumb[]; barClassName: string }) {
return (
<nav
data-slot="styled-breadcrumb"
aria-label="Breadcrumb"
className={cn("flex max-w-full items-center", box[size], barClassName, className)}
>
<ol className={cn("flex flex-wrap items-center", trail[size])}>
{items.map((item, i) => {
const last = i === items.length - 1
return (
<li key={i} className="inline-flex items-center gap-1.5">
{last || !item.href ? (
<span className={current} aria-current="page">
{item.label}
</span>
) : (
<a href={item.href} className={link}>
{item.label}
</a>
)}
{!last && (
<span className={sep} aria-hidden="true">
<ChevronRight />
</span>
)}
</li>
)
})}
</ol>
</nav>
)
}
/* Bar: full width, no corners; only the bottom line separates it from the content. */
export function BarBreadcrumb({ className, size = "md", items = defaultItems }: Props) {
return (
<BarTrail
className={className}
size={size}
items={items}
barClassName="w-full border-b border-border bg-background"
/>
)
}
/* Card: a rounded card with a shadow; the trail sits on a surface. */
export function CardBreadcrumb({ className, size = "md", items = defaultItems }: Props) {
return (
<BarTrail
className={className}
size={size}
items={items}
barClassName={cn(radius[size], "w-fit border border-border bg-card text-card-foreground shadow-sm")}
/>
)
}
/* Outline: a container with no fill; only the border draws the bounds of the trail. */
export function OutlineBreadcrumb({ className, size = "md", items = defaultItems }: Props) {
return (
<BarTrail
className={className}
size={size}
items={items}
barClassName={cn(radius[size], "w-fit border border-border bg-transparent")}
/>
)
}
/* Filled: dolu ikincil yuzey; kenarlik yok, kontrast dolgudan gelir. */
export function FilledBreadcrumb({ className, size = "md", items = defaultItems }: Props) {
return (
<BarTrail
className={className}
size={size}
items={items}
barClassName={cn(radius[size], "w-fit bg-secondary text-secondary-foreground")}
/>
)
}
/* Sticky: a bar that hangs at the top of a scrollable container. For the stickiness to work the container itself must be scrollable. */
export function StickyBreadcrumb({ className, size = "md", items = defaultItems }: Props) {
return (
<BarTrail
className={className}
size={size}
items={items}
barClassName="sticky top-0 z-20 w-full border-b border-[color-mix(in_oklab,var(--color-border)_80%,transparent)] bg-[color-mix(in_oklab,var(--color-background)_85%,transparent)] supports-[backdrop-filter]:backdrop-blur-sm"
/>
)
}Manual installs skip the @ai2/tokens theme, so add the token CSS from the theming guide or the tone colors will be missing.
Variations
5 takes on the same idea. Each is its own export, and every one accepts a size prop (sm, md, lg, xl) aligned to the base Button scale.
Bar
A full-width bar separated from the content by a bottom rule.
import { BarBreadcrumb } from "@/components/ui/breadcrumb-bar"
<BarBreadcrumb />Card
A rounded card surface with a soft shadow.
import { CardBreadcrumb } from "@/components/ui/breadcrumb-bar"
<CardBreadcrumb />Outline
No fill; only a border draws the boundary.
import { OutlineBreadcrumb } from "@/components/ui/breadcrumb-bar"
<OutlineBreadcrumb />Filled
A solid secondary surface with no border.
import { FilledBreadcrumb } from "@/components/ui/breadcrumb-bar"
<FilledBreadcrumb />Sticky
A translucent bar that pins to the top of a scrolling container.
import { StickyBreadcrumb } from "@/components/ui/breadcrumb-bar"
<StickyBreadcrumb />ai2 Bar breadcrumbs: 5 styled variations on the token system
The ai2 Bar breadcrumbs are a set of 5 decorative button variations from the styled layer of the @ai2 design system, built around breadcrumb trails inside a contained bar or card. They are free and MIT licensed, and every color comes from a semantic token, so they theme with the rest of ai2 in light and dark.
Motion runs on framer-motion: these are static; no motion library work is required. The styled layer is opt-in, so the dependency only lands if you use it; the base components stay lean. Under reduced motion, there is no motion to reduce.
What is in the ai2 Bar breadcrumbs?
5 exports in one file: Bar, Card, Outline, Filled and Sticky. Each renders a native button and takes a size prop (sm, md, lg, xl) aligned to the base Button. They are separate from the base Button on purpose: the base keeps its clean variant, tone and size axes, while the styled layer carries the effects.
You own the file. Copy the one category file and you have all 5 variations, with no runtime dependency on ai2 itself.
Why use it
- On-system by construction: Every color resolves to an ai2 semantic token, so the buttons follow your theme in light and dark with no extra work.
- Effect without the sprawl: The decorations live in a dedicated styled file, so the base Button keeps its clean, predictable API.
- Accessible and honest: Each renders a real button element, keeps a visible focus ring, and respects prefers-reduced-motion.
Features
- Token-driven color: No hardcoded hex or oklch; the look recolors with your theme tokens.
- framer-motion: these are static; no motion library work is required.
- Reduced-motion aware: Under prefers-reduced-motion, there is no motion to reduce.
- Size aligned to the base: Every variation takes sm, md, lg and xl matching the base Button height scale, so styled and base buttons line up in a row.
Production tips
- Use it for emphasis, not everywhere: Styled buttons draw the eye. Reserve them for the one action you want people to take on a screen, and use the base Button for the rest.
- Keep labels as verbs: The decoration adds weight, so a clear action label keeps the button scannable.
- Pick one variation per surface: The variations share a family; using two different ones in the same view competes for attention.
Works with the rest of ai2
The Bar breadcrumbs sit alongside the base Button and the rest of the @ai2 registry. They share the same token file, so a styled action next to a base button or a badge stays visually consistent in both modes.