shadcn-templ 2.0 beta. Switch to templUI v1
1.7k

Breadcrumb

Displays the path to the current resource using a hierarchy of links.

package examples import (

Installation

shadcn-templ add breadcrumb

Usage

import "github.com/axadrn/shadcn-templ/v2/components/breadcrumb"
@breadcrumb.Breadcrumb() {	@breadcrumb.List() {		@breadcrumb.Item() {			@breadcrumb.Link(breadcrumb.LinkProps{Href: "/"}) {				Home			}		}		@breadcrumb.Separator()		@breadcrumb.Item() {			@breadcrumb.Link(breadcrumb.LinkProps{Href: "/docs/components"}) {				Components			}		}		@breadcrumb.Separator()		@breadcrumb.Item() {			@breadcrumb.Page() {				Breadcrumb			}		}	}}

Composition

Use the following composition to build a Breadcrumb:

breadcrumb.Breadcrumb└── breadcrumb.List    ├── breadcrumb.Item    │   └── breadcrumb.Link    ├── breadcrumb.Separator    ├── breadcrumb.Item    │   └── breadcrumb.Link    ├── breadcrumb.Separator    └── breadcrumb.Item        └── breadcrumb.Page

Basic

A basic breadcrumb with a home link and a components link.

package examples import "github.com/axadrn/shadcn-templ/v2/components/breadcrumb"

Custom separator

Pass custom children to breadcrumb.Separator to replace the default separator icon.

package examples import (

You can compose breadcrumb.Item with a dropdownmenu to create a dropdown in the breadcrumb.

package examples import (

Collapsed

We provide a breadcrumb.Ellipsis component to show a collapsed state when the breadcrumb is too long.

package examples import "github.com/axadrn/shadcn-templ/v2/components/breadcrumb"

The breadcrumb.Link component renders a standard anchor. Set the Href prop to link a breadcrumb item.

package examples import "github.com/axadrn/shadcn-templ/v2/components/breadcrumb"

API Reference

The Breadcrumb component is the root navigation element that wraps all breadcrumb components.

Prop Type Default
Class string -

List

The breadcrumb.List component displays the ordered list of breadcrumb items.

Prop Type Default
Class string -

Item

The breadcrumb.Item component wraps individual breadcrumb items.

Prop Type Default
Class string -

The breadcrumb.Link component displays a clickable link in the breadcrumb.

Prop Type Default
Href string -
Class string -

Page

The breadcrumb.Page component displays the current page in the breadcrumb (non-clickable).

Prop Type Default
Class string -

Separator

The breadcrumb.Separator component displays a separator between breadcrumb items. Pass custom children to override the default separator icon.

Prop Type Default
Class string -

Ellipsis

The breadcrumb.Ellipsis component displays an ellipsis indicator for collapsed breadcrumb items.

Prop Type Default
Class string -