Keyframery

Breadcrumb

Crumbs arrive one after another with their chevrons drawing themselves, a crumb for a deeper page slides in from the right, and links underline from their start.

See it as an AI agent does.

Resize preview. Focus the handle and use the left or right arrow keys. Hold Shift for larger steps.— px
Customize1 controls
Animation speed1×

Installation

npx shadcn@latest add @keyframery/breadcrumb

This adds components/keyframery/breadcrumb.tsx and its primitive to your project, and installs UI SDK, along with agent-content, which it builds on. The motion tokens are added to your global CSS the first time you install a component.

Usage

import {
  Breadcrumb,
  BreadcrumbItem,
  BreadcrumbLink,
  BreadcrumbList,
  BreadcrumbPage,
  BreadcrumbSeparator,
} from "@/components/keyframery/breadcrumb"

export default function Usage() {
  return (
    <Breadcrumb>
      <BreadcrumbList>
        <BreadcrumbItem>
          <BreadcrumbLink href="/">Home</BreadcrumbLink>
        </BreadcrumbItem>
        <BreadcrumbSeparator />
        <BreadcrumbItem>
          <BreadcrumbPage>Settings</BreadcrumbPage>
        </BreadcrumbItem>
      </BreadcrumbList>
    </Breadcrumb>
  )
}

Anatomy

How the parts fit together:

Breadcrumb
└── BreadcrumbList
    ├── BreadcrumbItem
    │   └── BreadcrumbLink
    ├── BreadcrumbSeparator
    └── BreadcrumbItem
        └── BreadcrumbPage

Examples

Basic

The crumbs arrive one after another and each chevron draws itself. The last item is the page you are on.

Collapsed with a menu

Put BreadcrumbEllipsis in a menu trigger to list the pages a long trail leaves out. The menu unfolds from it.

render puts the link's behaviour and motion on your router's own link. Pass any mark as the separator's children.

Motion

MoveWhat you see
CascadeOn first render the crumbs and separators arrive one after another out of a blur.
DirectionGoing one level deeper, the new crumb slides in from the right at once.
DrawEach separator's chevron draws itself as it arrives.
DrawA link's underline grows from its start on hover or keyboard focus.
UnfoldIn a menu trigger, the ellipsis opens a menu of the pages it stands for.

Timing and springiness follow the motion style you set. To change how fast this breadcrumb moves, pass speed:

<Breadcrumb speed="fast">
  …
</Breadcrumb>

"fast" is 0.6×, "slow" 1.4×, and a number sets the multiplier. With reduced motion turned on, nothing moves: changes happen at once or with a short fade.

Theming

Set these CSS variables on the component or a parent. Leave them unset to follow the light and dark theme. The open Customize panel below the preview lets you try these settings.

VariableWhat it changesDefault
--breadcrumb-inkLink colourtext-muted-foreground
--breadcrumb-currentCurrent pagetext-foreground
--breadcrumb-separatorSeparator colourtext-muted-foreground/60
--breadcrumb-fontLabel sizetext-[13px]
--breadcrumb-gapTrail gapgap-1
--breadcrumb-item-gapIcon gapgap-1.5
--breadcrumb-icon-sizeIcon sizesize-3.5
--breadcrumb-radiusLink cornersrounded-[4px]

API reference

Every part takes className and children, along with the props of the element it renders. The parts are rendered by UI SDK, so they also take render, to draw your own element, and a function of their state for className and style.

Renders a <element>, and takes its props too.

Prop

Type

Other parts

These take the props of the element they render, and nothing else:

  • BreadcrumbList: a <ol>
  • BreadcrumbItem: a <li>
  • BreadcrumbLink: a <a>
  • BreadcrumbSeparator: a <li>
  • BreadcrumbPage: a <span>
  • BreadcrumbEllipsis: a <span>

Keyboard

KeyWhat it does
TabMoves between the links in the trail; the current page is skipped.
EnterFollows the focused link.

Accessibility

Roles, keyboard and focus are declared on the component's UI SDK primitive, and state is announced through the matching ARIA attributes. More in Accessibility.

Built on UI SDK's core

UI SDK doesn't ship a breadcrumb, so this one is defined with its core: one definePrimitive in components/keyframery/core/breadcrumb-core.ts, with no React in it. UI SDK's adapters can render that same definition in Vue, Svelte, Solid and web components. To keep your own styling and take only the motion, import from @/components/keyframery/primitives/breadcrumb.

Questions

How does the animated Breadcrumb for UI SDK move?

Cascade: On first render the crumbs and separators arrive one after another out of a blur. Direction: Going one level deeper, the new crumb slides in from the right at once. Draw: Each separator's chevron draws itself as it arrives. Draw: A link's underline grows from its start on hover or keyboard focus. Unfold: In a menu trigger, the ellipsis opens a menu of the pages it stands for.

Do I need Motion or Framer Motion for the animated Breadcrumb?

No. Every move is plain CSS, so there is nothing to install besides the component and UI SDK.

UI SDK has no breadcrumb. How is this one built on UI SDK?

Its behaviour is one definition written with UI SDK's core (definePrimitive), in components/keyframery/core/breadcrumb-core.ts. Its parts are rendered by UI SDK's adapter, so they take render, state-based class names and data-slot, like every UI SDK component.

What happens to the Breadcrumb when someone turns on reduced motion?

Nothing moves. State changes happen at once, or with a short fade.

All components

On this page