Skip to content

Commit 8f7eb97

Browse files
committed
Add 'as' prop to BreadcrumbItem
1 parent bed3c41 commit 8f7eb97

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

packages/ui/src/components/Breadcrumb/BreadcrumbItem.tsx

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { ComponentProps, FC } from "react";
1+
import type { ComponentProps, ElementType, FC } from "react";
22
import { forwardRef } from "react";
33
import { HiOutlineChevronRight } from "react-icons/hi";
44
import { twMerge } from "tailwind-merge";
@@ -15,15 +15,16 @@ export interface FlowbiteBreadcrumbItemTheme {
1515
}
1616

1717
export interface BreadcrumbItemProps extends Omit<ComponentProps<"li">, "ref"> {
18+
as?: ElementType;
1819
href?: string;
1920
icon?: FC<ComponentProps<"svg">>;
2021
theme?: DeepPartial<FlowbiteBreadcrumbItemTheme>;
2122
}
2223

2324
export const BreadcrumbItem = forwardRef<HTMLAnchorElement | HTMLSpanElement, BreadcrumbItemProps>(
24-
({ children, className, href, icon: Icon, theme: customTheme = {}, ...props }, ref) => {
25+
({ as = "a", children, className, href, icon: Icon, theme: customTheme = {}, ...props }, ref) => {
2526
const isLink = typeof href !== "undefined";
26-
const Component = isLink ? "a" : "span";
27+
const Component = isLink ? as : "span";
2728

2829
const theme = mergeDeep(getTheme().breadcrumb.item, customTheme);
2930

0 commit comments

Comments
 (0)