From 75e950248327837d985be9fbe9f1bbbc7e795a10 Mon Sep 17 00:00:00 2001 From: Johannes Liermann Date: Tue, 2 Dec 2025 12:30:25 +0100 Subject: [PATCH] feat(theme): Allow custom icon in DocCard component --- packages/docusaurus-theme-classic/src/theme/DocCard/index.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/docusaurus-theme-classic/src/theme/DocCard/index.tsx b/packages/docusaurus-theme-classic/src/theme/DocCard/index.tsx index 076235d687..d7a0bf7d34 100644 --- a/packages/docusaurus-theme-classic/src/theme/DocCard/index.tsx +++ b/packages/docusaurus-theme-classic/src/theme/DocCard/index.tsx @@ -113,7 +113,9 @@ function CardCategory({item}: {item: PropSidebarItemCategory}): ReactNode { } function CardLink({item}: {item: PropSidebarItemLink}): ReactNode { - const icon = isInternalUrl(item.href) ? '📄️' : '🔗'; + const defaultIcon = isInternalUrl(item.href) ? '📄' : '🔗'; + const customIcon = item.icon && item.icon !== ''; + const icon = customIcon ? item.icon : defaultIcon; const doc = useDocById(item.docId ?? undefined); return (