Breadcrumb

Displays the path to the current resource as a link hierarchy.

Installation

If @melio-ui/react is already installed globally, you can skip this step.

Import

  • BreadcrumbRoot: All parts of the breadcrumb are included.
  • BreadcrumbList: A container for breadcrumb items.
  • BreadcrumbItem: An individual breadcrumb element containing a link and a divider.
  • BreadcrumbLink: The breadcrumb link.
  • BreadcrumbSeparator: The visual separator between each breadcrumb element.
  • BreadcrumbCollapse: Display collapsed breadcrumbs.

Another way to import

'use client';
import { Breadcrumb } from '@melio-ui/breadcrumb';
<Breadcrumb.Root>
<Breadcrumb.List>
<Breadcrumb.Item />
</Breadcrumb.List>
</Breadcrumb.Root>;

'use client' must be used when rendering on the server side.

API Reference

All parts of the breadcrumb are included.

A container for breadcrumb items.

PropTypeDefaultDescription
maxItemsnumber5The maximum number of breadcrumb items that can be displayed.

When setting maxItems, collapse must also be set.
collapseReact.ReactNode...collapse node.

An individual breadcrumb element containing a link and a divider.

The breadcrumb link.

PropTypeDefaultDescription
hrefstring-Specify the href URL for the link.
asReact.ElementType-A property that allows you to dynamically determine the type of element to render.
asChildboolean-Changes the default rendering element passed as a child, merging its props and behavior.

The visual separator between each breadcrumb element.

Display collapsed breadcrumbs.

Examples

Custom separator

<BreadcrumbRoot>
<BreadcrumbList>
<BreadcrumbItem>
<BreadcrumbLink href="/">Home</BreadcrumbLink>
</BreadcrumbItem>
<BreadcrumbSeparator>{'>'}</BreadcrumbSeparator>
<BreadcrumbItem>
<BreadcrumbLink href="/page">Page</BreadcrumbLink>
</BreadcrumbItem>
<BreadcrumbSeparator>{'>'}</BreadcrumbSeparator>
<BreadcrumbItem>Current</BreadcrumbItem>
</BreadcrumbList>
</BreadcrumbRoot>

Max

When setting maxItems, collapse must also be set.

<BreadcrumbRoot>
<BreadcrumbList maxItems={3} collapse={<BreadcrumbCollapse />}>
<BreadcrumbItem>
<BreadcrumbLink href="/">Home</BreadcrumbLink>
</BreadcrumbItem>
<BreadcrumbSeparator />
<BreadcrumbItem>
<BreadcrumbLink href="/page1">Page1</BreadcrumbLink>
</BreadcrumbItem>
<BreadcrumbSeparator />
<BreadcrumbItem>
<BreadcrumbLink href="/page2">Page2</BreadcrumbLink>
</BreadcrumbItem>
<BreadcrumbSeparator />
<BreadcrumbItem>
<BreadcrumbLink href="/page3">Page3</BreadcrumbLink>
</BreadcrumbItem>
<BreadcrumbSeparator />
<BreadcrumbItem>Current</BreadcrumbItem>
</BreadcrumbList>
</BreadcrumbRoot>

Custom Collapsed

<BreadcrumbRoot>
<BreadcrumbList maxItems={3} collapse={<div>~~~</div>}>
<BreadcrumbItem>
<BreadcrumbLink href="/">Home</BreadcrumbLink>
</BreadcrumbItem>
<BreadcrumbSeparator />
<BreadcrumbItem>
<BreadcrumbLink href="/page1">Page1</BreadcrumbLink>
</BreadcrumbItem>
<BreadcrumbSeparator />
<BreadcrumbItem>
<BreadcrumbLink href="/page2">Page2</BreadcrumbLink>
</BreadcrumbItem>
<BreadcrumbSeparator />
<BreadcrumbItem>
<BreadcrumbLink href="/page3">Page3</BreadcrumbLink>
</BreadcrumbItem>
<BreadcrumbSeparator />
<BreadcrumbItem>Current</BreadcrumbItem>
</BreadcrumbList>
</BreadcrumbRoot>
DocsMelioUI
Copyright © Ahn Co. All rights reserved.