snapshot of https://github.com/shadcn-ui/ui.git (main, 2026-09-15; blobs > 131072B omitted)
This commit is contained in:
197
apps/v4/content/docs/components/aria/breadcrumb.mdx
Normal file
197
apps/v4/content/docs/components/aria/breadcrumb.mdx
Normal file
@@ -0,0 +1,197 @@
|
||||
---
|
||||
title: Breadcrumb
|
||||
description: Displays the path to the current resource using a hierarchy of links.
|
||||
base: aria
|
||||
component: true
|
||||
links:
|
||||
doc: https://react-aria.adobe.com/Breadcrumbs
|
||||
api: https://react-aria.adobe.com/Breadcrumbs#api
|
||||
---
|
||||
|
||||
<ComponentPreview
|
||||
styleName="aria-nova"
|
||||
name="breadcrumb-demo"
|
||||
previewClassName="p-2"
|
||||
/>
|
||||
|
||||
## Installation
|
||||
|
||||
<CodeTabs>
|
||||
|
||||
<TabsList>
|
||||
<TabsTrigger value="cli">Command</TabsTrigger>
|
||||
<TabsTrigger value="manual">Manual</TabsTrigger>
|
||||
</TabsList>
|
||||
<TabsContent value="cli">
|
||||
|
||||
```bash
|
||||
npx shadcn@latest add breadcrumb
|
||||
```
|
||||
|
||||
</TabsContent>
|
||||
|
||||
<TabsContent value="manual">
|
||||
|
||||
<Step>Install the following dependencies:</Step>
|
||||
|
||||
```bash
|
||||
npm install react-aria-components
|
||||
```
|
||||
|
||||
<Steps className="mb-0 pt-2">
|
||||
|
||||
<Step>Copy and paste the following code into your project.</Step>
|
||||
|
||||
<ComponentSource
|
||||
name="breadcrumb"
|
||||
title="components/ui/breadcrumb.tsx"
|
||||
styleName="aria-nova"
|
||||
/>
|
||||
|
||||
<Step>Update the import paths to match your project setup.</Step>
|
||||
|
||||
</Steps>
|
||||
|
||||
</TabsContent>
|
||||
|
||||
</CodeTabs>
|
||||
|
||||
## Usage
|
||||
|
||||
```tsx showLineNumbers
|
||||
import {
|
||||
Breadcrumb,
|
||||
BreadcrumbItem,
|
||||
BreadcrumbLink,
|
||||
BreadcrumbList,
|
||||
BreadcrumbPage,
|
||||
} from "@/components/ui/breadcrumb"
|
||||
```
|
||||
|
||||
```tsx showLineNumbers
|
||||
<Breadcrumb>
|
||||
<BreadcrumbList>
|
||||
<BreadcrumbItem>
|
||||
<BreadcrumbLink href="/">Home</BreadcrumbLink>
|
||||
</BreadcrumbItem>
|
||||
<BreadcrumbItem>
|
||||
<BreadcrumbLink href="/components">Components</BreadcrumbLink>
|
||||
</BreadcrumbItem>
|
||||
<BreadcrumbItem>
|
||||
<BreadcrumbPage>Breadcrumb</BreadcrumbPage>
|
||||
</BreadcrumbItem>
|
||||
</BreadcrumbList>
|
||||
</Breadcrumb>
|
||||
```
|
||||
|
||||
## Composition
|
||||
|
||||
Use the following composition to build a `Breadcrumb`:
|
||||
|
||||
```text
|
||||
Breadcrumb
|
||||
└── BreadcrumbList
|
||||
├── BreadcrumbItem
|
||||
│ └── BreadcrumbLink
|
||||
├── BreadcrumbItem
|
||||
│ └── BreadcrumbLink
|
||||
└── BreadcrumbItem
|
||||
└── BreadcrumbPage
|
||||
```
|
||||
|
||||
## Basic
|
||||
|
||||
A basic breadcrumb with a home link and a components link.
|
||||
|
||||
<ComponentPreview styleName="aria-nova" name="breadcrumb-basic" />
|
||||
|
||||
## Custom separator
|
||||
|
||||
Use a custom component as `children` for `<BreadcrumbSeparator />` to create a custom separator.
|
||||
|
||||
<ComponentPreview styleName="aria-nova" name="breadcrumb-separator" />
|
||||
|
||||
## Dropdown
|
||||
|
||||
You can compose `<BreadcrumbItem />` with a `<DropdownMenu />` to create a dropdown in the breadcrumb.
|
||||
|
||||
<ComponentPreview styleName="aria-nova" name="breadcrumb-dropdown" />
|
||||
|
||||
## Collapsed
|
||||
|
||||
We provide a `<BreadcrumbEllipsis />` component to show a collapsed state when the breadcrumb is too long.
|
||||
|
||||
<ComponentPreview
|
||||
styleName="aria-nova"
|
||||
name="breadcrumb-ellipsis"
|
||||
previewClassName="p-2"
|
||||
/>
|
||||
|
||||
## Link component
|
||||
|
||||
To use a custom link component from your routing library, you can use the `render` prop on `<BreadcrumbLink />`.
|
||||
|
||||
<ComponentPreview styleName="aria-nova" name="breadcrumb-link" />
|
||||
|
||||
## RTL
|
||||
|
||||
To enable RTL support in shadcn/ui, see the [RTL configuration guide](/docs/rtl).
|
||||
|
||||
<ComponentPreview
|
||||
styleName="aria-nova"
|
||||
name="breadcrumb-rtl"
|
||||
direction="rtl"
|
||||
previewClassName="p-2"
|
||||
/>
|
||||
|
||||
## API Reference
|
||||
|
||||
### Breadcrumb
|
||||
|
||||
The `Breadcrumb` component is the root navigation element that wraps all breadcrumb components.
|
||||
|
||||
| Prop | Type | Default |
|
||||
| ----------- | -------- | ------- |
|
||||
| `className` | `string` | - |
|
||||
|
||||
### BreadcrumbList
|
||||
|
||||
The `BreadcrumbList` component displays the ordered list of breadcrumb items.
|
||||
|
||||
| Prop | Type | Default |
|
||||
| ----------- | -------- | ------- |
|
||||
| `className` | `string` | - |
|
||||
|
||||
### BreadcrumbItem
|
||||
|
||||
The `BreadcrumbItem` component wraps individual breadcrumb items.
|
||||
|
||||
| Prop | Type | Default |
|
||||
| ----------- | -------- | ------- |
|
||||
| `className` | `string` | - |
|
||||
|
||||
### BreadcrumbLink
|
||||
|
||||
The `BreadcrumbLink` component displays a clickable link in the breadcrumb.
|
||||
|
||||
| Prop | Type | Default |
|
||||
| ----------- | -------- | ------- |
|
||||
| `className` | `string` | - |
|
||||
|
||||
### BreadcrumbPage
|
||||
|
||||
The `BreadcrumbPage` component displays the current page in the breadcrumb (non-clickable).
|
||||
|
||||
| Prop | Type | Default |
|
||||
| ----------- | -------- | ------- |
|
||||
| `className` | `string` | - |
|
||||
|
||||
### BreadcrumbEllipsis
|
||||
|
||||
The `BreadcrumbEllipsis` component displays an ellipsis indicator for collapsed breadcrumb items.
|
||||
|
||||
| Prop | Type | Default |
|
||||
| ----------- | -------- | ------- |
|
||||
| `className` | `string` | - |
|
||||
|
||||
For more information, see the [React Aria documentation](https://react-aria.adobe.com/Breadcrumbs#api).
|
||||
Reference in New Issue
Block a user