mirror of
https://github.com/shadcn-ui/ui.git
synced 2026-06-30 08:04:18 +00:00
* feat: add base and radix docs * feat: transform code for display * fix * fix * fix * fix * fix * chore: remove claude files * fix * fix * fix * chore: run format:write * fix * feat: add more examples * fix * feat: add aspect-ratio * feat: add avatar * feat: add badge * feat: add breadcrumb * fix * feat: add button * fix * fix * fix * feat: add calendar and card * feat: add carousel * fix: chart * feat: add checkbox * feat: add collapsible * feat: add combobox * feat: add command * feat: add context menu * feat: add data-table dialog and drawer * feat: dropdown-menu * feat: add date-picker * feat: add empty * feat: add field and hover-card * fix: input * feat: add input * feat: add input-group * feat: add input-otp * feat: add item * feat: add kbd and label * feat: add menubar * feat: add native-select * feat: add more components * feat: more components * feat: more components * feat: add skeleton, slider and sonner * feat: add spinner and switch * feat: add more components * fix: tabs * fix: tabs * feat: add docs for sidebar * fix * fix * fi * docs: update * fix: create page * fix * fix * chore: add changelog * fix
177 lines
4.0 KiB
Plaintext
177 lines
4.0 KiB
Plaintext
---
|
|
title: Breadcrumb
|
|
description: Displays the path to the current resource using a hierarchy of links.
|
|
base: base
|
|
component: true
|
|
---
|
|
|
|
<ComponentPreview
|
|
styleName="base-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">
|
|
|
|
<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="base-nova"
|
|
/>
|
|
|
|
<Step>Update the import paths to match your project setup.</Step>
|
|
|
|
</Steps>
|
|
|
|
</TabsContent>
|
|
|
|
</CodeTabs>
|
|
|
|
## Usage
|
|
|
|
```tsx showLineNumbers
|
|
import {
|
|
Breadcrumb,
|
|
BreadcrumbItem,
|
|
BreadcrumbLink,
|
|
BreadcrumbList,
|
|
BreadcrumbPage,
|
|
BreadcrumbSeparator,
|
|
} from "@/components/ui/breadcrumb"
|
|
```
|
|
|
|
```tsx showLineNumbers
|
|
<Breadcrumb>
|
|
<BreadcrumbList>
|
|
<BreadcrumbItem>
|
|
<BreadcrumbLink render={<a href="/" />}>Home</BreadcrumbLink>
|
|
</BreadcrumbItem>
|
|
<BreadcrumbSeparator />
|
|
<BreadcrumbItem>
|
|
<BreadcrumbLink render={<a href="/components" />}>
|
|
Components
|
|
</BreadcrumbLink>
|
|
</BreadcrumbItem>
|
|
<BreadcrumbSeparator />
|
|
<BreadcrumbItem>
|
|
<BreadcrumbPage>Breadcrumb</BreadcrumbPage>
|
|
</BreadcrumbItem>
|
|
</BreadcrumbList>
|
|
</Breadcrumb>
|
|
```
|
|
|
|
## Examples
|
|
|
|
### Basic
|
|
|
|
A basic breadcrumb with a home link and a components link.
|
|
|
|
<ComponentPreview styleName="base-nova" name="breadcrumb-basic" />
|
|
|
|
### Custom separator
|
|
|
|
Use a custom component as `children` for `<BreadcrumbSeparator />` to create a custom separator.
|
|
|
|
<ComponentPreview styleName="base-nova" name="breadcrumb-separator" />
|
|
|
|
### Dropdown
|
|
|
|
You can compose `<BreadcrumbItem />` with a `<DropdownMenu />` to create a dropdown in the breadcrumb.
|
|
|
|
<ComponentPreview styleName="base-nova" name="breadcrumb-dropdown" />
|
|
|
|
### Collapsed
|
|
|
|
We provide a `<BreadcrumbEllipsis />` component to show a collapsed state when the breadcrumb is too long.
|
|
|
|
<ComponentPreview
|
|
styleName="base-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="base-nova" name="breadcrumb-link" />
|
|
|
|
## 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` | - |
|
|
|
|
### BreadcrumbSeparator
|
|
|
|
The `BreadcrumbSeparator` component displays a separator between breadcrumb items. You can pass custom children to override the default separator icon.
|
|
|
|
| Prop | Type | Default |
|
|
| ----------- | ----------------- | ------- |
|
|
| `children` | `React.ReactNode` | - |
|
|
| `className` | `string` | - |
|
|
|
|
### BreadcrumbEllipsis
|
|
|
|
The `BreadcrumbEllipsis` component displays an ellipsis indicator for collapsed breadcrumb items.
|
|
|
|
| Prop | Type | Default |
|
|
| ----------- | -------- | ------- |
|
|
| `className` | `string` | - |
|