Breadcrumb
indiacn/breadcrumbFreeComponent
Navigation trail showing the current page's hierarchy.
Install it
npx shadcn@latest add https://indiacn.in/r/breadcrumb.jsonSource
1import { MoreHorizontal } from 'lucide-react';2import { ComponentProps } from 'react';34import { Body2, Label2 } from '@/components/ui/typography';5import { cn } from '@/lib/utils';67/* UX4G breadcrumb: divider "/", divider-color neutral-500, active-color neutral, link-color neutral-500 */89/** Root navigation container for breadcrumb trails. */10function Breadcrumb({ ...props }: ComponentProps<'nav'>) {11 return <nav aria-label='breadcrumb' {...props} />;12}1314/** Ordered list container for breadcrumb items. */15function BreadcrumbList({ className, ...props }: ComponentProps<'ol'>) {16 return (17 <ol18 className={cn(19 'mb-4 flex list-none flex-wrap items-center gap-2 p-0 wrap-break-word',20 className,21 )}22 {...props}23 />24 );25}2627/** Individual breadcrumb item wrapper. */28function BreadcrumbItem({ className, ...props }: ComponentProps<'li'>) {29 return <li className={cn('inline-flex items-center gap-2', className)} {...props} />;30}3132/** Link element for navigable breadcrumb items. */33function BreadcrumbLink({ className, children, ...props }: ComponentProps<'a'>) {34 return (35 <a36 className={cn(37 'hover:text-neutral text-neutral-500 no-underline transition-colors',38 className,39 )}40 {...props}41 >42 <Body2>{children}</Body2>43 </a>44 );45}4647/** Non-interactive element for the current page in breadcrumb. */48function BreadcrumbPage({ className, children, ...props }: ComponentProps<'p'>) {49 return (50 <Body2 aria-current='page' className={cn('text-neutral font-medium', className)} {...props}>51 {children}52 </Body2>53 );54}5556/** Visual separator between breadcrumb items. */57function BreadcrumbSeparator({ children, className, ...props }: ComponentProps<'li'>) {58 return (59 <li60 role='presentation'61 aria-hidden='true'62 className={cn('text-neutral-500 [&>svg]:size-3.5', className)}63 {...props}64 >65 {children ?? <Body2>/</Body2>}66 </li>67 );68}6970/** Ellipsis indicator for collapsed breadcrumb items. */71function BreadcrumbEllipsis({ className, ...props }: ComponentProps<'div'>) {72 return (73 <div74 role='presentation'75 aria-hidden='true'76 className={cn('flex size-9 items-center justify-center text-neutral-500', className)}77 {...props}78 >79 <MoreHorizontal className='size-4' />80 <Label2 className='sr-only'>More</Label2>81 </div>82 );83}8485export {86 Breadcrumb,87 BreadcrumbList,88 BreadcrumbItem,89 BreadcrumbLink,90// … truncated
What it pulls in
npm packages
Other registry items
Files it writes
More from indiacn
All 26 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| Accordionaccordion | indiacn | Components | Free | 2 deps | |
| Alertalert | indiacn | Components | Free | 2 deps | |
| Badgebadge | indiacn | Components | Free | 1 dep | |
| Buttonbutton | indiacn | Components | Free | 3 deps | |
| Button Groupbutton-group | indiacn | Components | Free | no deps | |
| Cardcard | indiacn | Components | Free | 1 dep | |
| Chipchip | indiacn | Components | Free | 2 deps | |
| Collapsecollapse | indiacn | Components | Free | 1 dep |
