-
-
Notifications
You must be signed in to change notification settings - Fork 8.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allowing custom icons in the DocCards #9268
Conversation
✅ [V2]Built without sensitive environment variables
To edit notification comments on pull requests, go to your Netlify site configuration. |
⚡️ Lighthouse report for the deploy preview of this PR
|
@@ -85,7 +85,7 @@ function CardCategory({ | |||
return ( | |||
<CardLayout | |||
href={href} | |||
icon="🗃️" | |||
icon={(item.customProps?.customIcon as ReactNode) || '🗃️'} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
customProps is for props that are provided by the end user.
If we were to implement this feature, we wouldn't use customProps but rather make it a first-class feature by adding some kind of item.icon
to our validation schemas (sidebar items + frontMatter)
I understand the need for this, but unfortunately don't want to merge this for various reasons exposed here:
Overall what you propose is a good idea for your own site, that you can apply through swizzling. But it does not look like the best long-term option for an official public Docusaurus API. Also we want to normalize how we use icons in Docusaurus in the future. It's likely that we'll migrate away from emojis in the future, so I'd rather not introduce any new API that could only work with emojis. So, I'm going to close this PR for now, but we'll keep thinking about how to make your use case easier. One idea in the future could be to have an If you want to work on this, or any Docusaurus feature introducing a new public API, it's preferable to open a proposal before so that we can discuss the details.
Maybe our onboarding docs are not up to date, what did you try and what blocked you? |
Pre-flight checklist
Motivation
When creating a separated blog I wanted to have custom icons of instead the 3 available.
This way a page can determine by just adding in the heading
sidebar_custom_props: customIcon: 🚀
Test Plan
No bonus points for me, I haven't been able to make the repo run for me.
I'll be making help requests in the discord server.
Test links
Deploy preview: https://deploy-preview-9268--docusaurus-2.netlify.app/
Related issues/PRs
I just started to code, should I make an issue for this?