docusaurus icon indicating copy to clipboard operation
docusaurus copied to clipboard

feat(theme): allow custom icons in DocCard component

Open jliermann opened this issue 2 weeks ago • 1 comments

Pre-flight checklist

  • [x] I have read the Contributing Guidelines on pull requests.
  • [x] If this is a code change: I have written unit tests and/or added dogfooding pages to fully verify the new behavior.
  • [ ] If this is a new API or substantial change: the PR has an accompanying issue (closes #0000) and the maintainers have approved on my working plan.

Motivation

I had a project were I wanted to use the DocCard component from the theme with custom icons. I was able to swizzle it but considered that this addition might be of broader interest. The component accepts a property item.icon of type "string". It does currently not support image files but is also not broken by them.

Test Plan

I added a dogfooding doc under /tests/docs/doc-cards with different cases:

  • Custom UTF emoji icon as string prop
  • No custom icon (internal / external link)
  • Several image files passed as props (unsupported)
grafik

Test links

Deploy preview: https://deploy-preview-11596--docusaurus-2.netlify.app/

Related issues/PRs

jliermann avatar Dec 02 '25 15:12 jliermann

[V2]

Built without sensitive environment variables

Name Link
Latest commit 5320efc2b0326322288e86320b152b7fc95aa647
Latest deploy log https://app.netlify.com/projects/docusaurus-2/deploys/692f18248e67d8000894447d
Deploy Preview https://deploy-preview-11596--docusaurus-2.netlify.app
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

netlify[bot] avatar Dec 02 '25 16:12 netlify[bot]

Thanks, @slorber, for the detailled and very helpful comments. I do understand that the scope of this change is too limited for merging. I will put some thought into how I can contribute to the feature requested in #7844.

jliermann avatar Dec 05 '25 13:12 jliermann

Thanks

I think it would be better to open a RFC and once we agree on what should be done, open a new PR.

For now I'm closing this one

slorber avatar Dec 05 '25 18:12 slorber