Breadcrumb
solid-ui/breadcrumbFreeComponent
A breadcrumb component
Live preview
live · rendered by the registry
Rendered by solid-ui on their own page — this is the component running, not a screenshot of it.Install it
npx shadcn@latest add https://www.solid-ui.com/r/breadcrumb.jsonSource
1import type { Component, ComponentProps, JSX, ValidComponent } from "solid-js"2import { Show, splitProps } from "solid-js"34import type { PolymorphicProps } from "@kobalte/core"5import * as BreadcrumbPrimitive from "@kobalte/core/breadcrumbs"67import { cn } from "~/lib/utils"89const Breadcrumb = BreadcrumbPrimitive.Root1011const BreadcrumbList: Component<ComponentProps<"ol">> = (props) => {12 const [local, others] = splitProps(props, ["class"])13 return (14 <ol15 class={cn(16 "flex flex-wrap items-center gap-1.5 break-words text-sm text-muted-foreground sm:gap-2.5",17 local.class18 )}19 {...others}20 />21 )22}2324const BreadcrumbItem: Component<ComponentProps<"li">> = (props) => {25 const [local, others] = splitProps(props, ["class"])26 return <li class={cn("inline-flex items-center gap-1.5", local.class)} {...others} />27}2829type BreadcrumbLinkProps<T extends ValidComponent = "a"> =30 BreadcrumbPrimitive.BreadcrumbsLinkProps<T> & { class?: string | undefined }3132const BreadcrumbLink = <T extends ValidComponent = "a">(33 props: PolymorphicProps<T, BreadcrumbLinkProps<T>>34) => {35 const [local, others] = splitProps(props as BreadcrumbLinkProps, ["class"])36 return (37 <BreadcrumbPrimitive.Link38 class={cn(39 "transition-colors hover:text-foreground data-[current]:font-normal data-[current]:text-foreground",40 local.class41 )}42 {...others}43 />44 )45}4647type BreadcrumbSeparatorProps<T extends ValidComponent = "span"> =48 BreadcrumbPrimitive.BreadcrumbsSeparatorProps<T> & {49 class?: string | undefined50 children?: JSX.Element51 }5253const BreadcrumbSeparator = <T extends ValidComponent = "span">(54 props: PolymorphicProps<T, BreadcrumbSeparatorProps<T>>55) => {56 const [local, others] = splitProps(props as BreadcrumbSeparatorProps, ["class", "children"])57 return (58 <BreadcrumbPrimitive.Separator class={cn("[&>svg]:size-3.5", local.class)} {...others}>59 <Show60 when={local.children}61 fallback={62 <svg63 xmlns="http://www.w3.org/2000/svg"64 viewBox="0 0 24 24"65 fill="none"66 stroke="currentColor"67 stroke-width="2"68 stroke-linecap="round"69 stroke-linejoin="round"70 >71 <path d="M9 6l6 6l-6 6" />72 </svg>73 }74 >75 {local.children}76 </Show>77 </BreadcrumbPrimitive.Separator>78 )79}8081const BreadcrumbEllipsis: Component<ComponentProps<"span">> = (props) => {82// … truncated
What it pulls in
npm packages
Files it writes
More from solid-ui
All 55 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| Accordionaccordion | solid-ui | Components | Free | 2 deps | |
| Alertalert | solid-ui | Components | Free | 3 deps | |
| Alert Dialogalert-dialog | solid-ui | Components | Free | 2 deps | |
| Aspect Ratioaspect-ratio | solid-ui | Components | Free | 1 dep | |
| Avataravatar | solid-ui | Components | Free | 2 deps | |
| Badgebadge | solid-ui | Components | Free | 2 deps | |
| Badge Deltabadge-delta | solid-ui | Components | Free | 2 deps | |
| Bar Listbar-list | solid-ui | Components | Free | 1 dep |
