Skip to contents

A breadcrumb navigation trail. Compose with shad_breadcrumb_item(), shad_breadcrumb_separator() and shad_breadcrumb_ellipsis(), or pass a named items vector for the common case.

Usage

shad_breadcrumb(..., items = NULL, class = NULL)

shad_breadcrumb_item(label, href = NULL, current = FALSE)

shad_breadcrumb_separator()

shad_breadcrumb_ellipsis()

Arguments

...

Breadcrumb parts. Ignored when items is supplied.

items

Optional named character vector: names are labels, values are hrefs. Use NA as the href to mark the current page. Separators are inserted automatically.

class

Extra CSS classes.

label

Item label.

href

Link URL; omit for a non-link item.

current

If TRUE, renders the current-page item (non-link).

Value

A <nav class="shad-breadcrumb">.

Examples

shad_breadcrumb(items = c(Home = "/", Docs = "/docs", Breadcrumb = NA))
#> <nav class="shad-breadcrumb" aria-label="Breadcrumb">
#>   <ol class="shad-breadcrumb__list">
#>     <li class="shad-breadcrumb__item">
#>       <a class="shad-breadcrumb__link" href="/">Home</a>
#>     </li>
#>     <li class="shad-breadcrumb__separator" role="presentation" aria-hidden="true">
#>       <svg class="shad-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="m9 18 6-6-6-6"/></svg>
#>     </li>
#>     <li class="shad-breadcrumb__item">
#>       <a class="shad-breadcrumb__link" href="/docs">Docs</a>
#>     </li>
#>     <li class="shad-breadcrumb__separator" role="presentation" aria-hidden="true">
#>       <svg class="shad-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="m9 18 6-6-6-6"/></svg>
#>     </li>
#>     <li class="shad-breadcrumb__item">
#>       <span class="shad-breadcrumb__page" role="link" aria-disabled="true" aria-current="page">Breadcrumb</span>
#>     </li>
#>   </ol>
#> </nav>