Skip to Content

Built by moveinready.casa  and the community

Shadcn Docs

Breadcrumb

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

Usage

import { Breadcrumb, BreadcrumbList, BreadcrumbItem, BreadcrumbLink, BreadcrumbPage, BreadcrumbSeparator, BreadcrumbEllipsis, } from "@/components/ui/breadcrumb"; <Breadcrumb> <BreadcrumbList> <BreadcrumbItem> <BreadcrumbLink href="/">Home</BreadcrumbLink> </BreadcrumbItem> <BreadcrumbSeparator /> <BreadcrumbEllipsis /> <BreadcrumbSeparator /> <BreadcrumbItem> <BreadcrumbLink href="/components">Components</BreadcrumbLink> </BreadcrumbItem> <BreadcrumbSeparator /> <BreadcrumbItem> <BreadcrumbPage>Breadcrumb</BreadcrumbPage> </BreadcrumbItem> </BreadcrumbList> </Breadcrumb>;

Components

PropTypeDefaultDescription
size"sm" | "md" | "lg""md"The size of the breadcrumb. Controls the text size and spacing.
color"default" | "warning" | "destructive" | "success""default"The color variant of the breadcrumb. Affects text and hover colors.
variant"shadcn" | "bordered" | "solid""shadcn"The visual variant of the breadcrumb.
borderRadius"none" | "sm" | "md" | "lg" | "xl""md"Sets the border radius of the breadcrumb.
asChildbooleanfalseIf true clones the child and passes all accessibility and functionality props to it. Available on any exported component.
baseClassNamestring-Custom tailwind classes to apply to the base breadcrumb component. Takes priority over the className prop.

Also extends all React Native View component props.

PropTypeDefaultDescription
asChildbooleanfalseIf true clones the child and passes all accessibility and functionality props to it. Available on any exported component.
baseClassNamestring-Custom tailwind classes to apply to the base breadcrumb list component. Takes priority over the className prop.

Also extends all React Native View component props.

PropTypeDefaultDescription
disabledbooleanfalseWhether the breadcrumb item is disabled.
asChildbooleanfalseIf true clones the child and passes all accessibility and functionality props to it. Available on any exported component.
baseClassNamestring-Custom tailwind classes to apply to the base breadcrumb item component. Takes priority over the className prop.

Also extends all React Native View component props.

PropTypeDefaultDescription
hrefstring-The URL to navigate to when the link is pressed.
startContentReact.ReactNode-Start content (ReactNode) to display before the link text.
endContentReact.ReactNode-End content (ReactNode) to display after the link text.
asChildbooleanfalseIf true clones the child and passes all accessibility and functionality props to it. Available on any exported component.
baseClassNamestring-Custom tailwind classes to apply to the base breadcrumb link component. Takes priority over the className prop.

Also extends all React Native Pressable component props.

PropTypeDefaultDescription
asChildbooleanfalseIf true clones the child and passes all accessibility and functionality props to it. Available on any exported component.
baseClassNamestring-Custom tailwind classes to apply to the base breadcrumb page component. Takes priority over the className prop.

Also extends all React Native Text component props.

PropTypeDefaultDescription
asChildbooleanfalseIf true clones the child and passes all accessibility and functionality props to it. Available on any exported component.
baseClassNamestring-Custom tailwind classes to apply to the base breadcrumb separator component. Takes priority over the className prop.

Also extends all React Native View component props.

PropTypeDefaultDescription
asChildbooleanfalseIf true clones the child and passes all accessibility and functionality props to it. Available on any exported component.
baseClassNamestring-Custom tailwind classes to apply to the base breadcrumb ellipsis component. Takes priority over the className prop.

Also extends all React Native View component props.

Hooks

useBreadcrumb

The backbone hook for the breadcrumb component that provides accessibility props.

Parameters:

ParameterTypeDefaultDescription
propsBreadcrumbProps-Props to configure the behavior of the breadcrumb.

Returns:

{ navProps: React.ComponentProps<typeof View> | HTMLDivElement; listProps: React.ComponentProps<typeof View> | HTMLDivElement; }
PropertyTypeDescription
navPropsReact.ComponentProps<typeof View>Accessibility props to pass to the navigation component.
listPropsReact.ComponentProps<typeof View>Accessibility props to pass to the list component.

useBreadcrumbItem

The backbone hook for the breadcrumb item component that provides accessibility props.

Parameters:

ParameterTypeDefaultDescription
propsBreadcrumbItemProps-Props to configure the behavior of the breadcrumb item.

Returns:

{ componentProps: React.ComponentProps<typeof View> | HTMLDivElement; linkProps: React.ComponentProps<typeof Pressable> | HTMLAnchorElement; pageProps: React.ComponentProps<typeof Text> | HTMLSpanElement; }
PropertyTypeDescription
componentPropsReact.ComponentProps<typeof View>Accessibility props to pass to the breadcrumb item component.
linkPropsReact.ComponentProps<typeof Pressable>Props to pass to the breadcrumb link component.
pagePropsReact.ComponentProps<typeof Text>Props to pass to the breadcrumb page component.

Accessibility

The Breadcrumb component is built with accessibility in mind and includes:

Web Accessibility

  • Uses useBreadcrumbs hook for proper breadcrumb semantics
  • Uses useBreadcrumbItem for individual breadcrumb item semantics
  • Supports ARIA attributes: role="navigation", role="list", role="listitem"
  • Keyboard navigation support
  • Proper focus management

React Native Accessibility

  • accessibilityRole="navigation" for proper screen reader announcement
  • accessibilityRole="list" and accessibilityRole="listitem" for list structure
  • accessibilityRole="link" for clickable breadcrumb items
  • Proper focus management for screen readers
  • accessibilityState for disabled states

Styling

Variants:

  • variant:
    • shadcn (default) - Default styling
    • bordered - Bordered styling: border border-border
    • solid - Solid styling: bg-background border border-border
  • borderRadius:
    • none - No radius: rounded-none
    • sm - Small radius: rounded-sm
    • md (default) - Medium radius: rounded-md
    • lg - Large radius: rounded-lg
    • xl - Extra large radius: rounded-xl

Base Classes: p-2

Variants:

  • variant:
    • shadcn (default) - Default styling
    • bordered - Bordered styling: border border-border
    • solid - Solid styling: bg-background border border-border
  • borderRadius:
    • none - No radius: rounded-none
    • sm - Small radius: rounded-sm
    • md (default) - Medium radius: rounded-md
    • lg - Large radius: rounded-lg
    • xl - Extra large radius: rounded-xl

Base Classes: flex flex-row flex-wrap items-center gap-1.5 break-words sm:gap-2.5 p-2 w-fit

Slots:

  • base - For the base Pressable in the breadcrumb link component
  • text - For the text element in the breadcrumb link component

Variants:

  • size:
    • sm - Small text: text-xs
    • md (default) - Medium text: text-sm
    • lg - Large text: text-base
  • color:
    • default (default) - Default text color: hover:text-foreground
    • warning - Warning text color: hover:text-warning
    • destructive - Destructive text color: hover:text-destructive
    • success - Success text color: hover:text-success

Base Classes:

  • base: flex-row items-center gap-1
  • text: text-muted-foreground transition-colors

Variants:

  • size:
    • sm - Small text: text-xs
    • md (default) - Medium text: text-sm
    • lg - Large text: text-base
  • color:
    • default (default) - Default text color: text-foreground
    • warning - Warning text color: text-warning
    • destructive - Destructive text color: text-destructive
    • success - Success text color: text-success

Variants:

  • size:
    • sm - Small size: size-3
    • md (default) - Medium size: size-3.5
    • lg - Large size: size-4

Base Classes: text-muted-foreground

Variants:

  • size:
    • sm - Small size: size-3
    • md (default) - Medium size: size-3.5
    • lg - Large size: size-4

Base Classes: text-muted-foreground

shadcn-native

Built by moveinready.casa and the community