Repository navigation
Description
Have you read the Contributing Guidelines on issues?
- I have read the Contributing Guidelines on issues.
Description
This RFC aims to standardise the common request for including custom icons on cards. The goal is to make documentation card links more intuitive for readers and more aesthetically pleasing.
Instead of this:
You can have this:
Has this been requested on Canny?
Motivation
The primary motivation for implementing this is that it has been requested multiple times:
- Discussed in How to set different icon for `Autogenerated` doc list #10476
- Suggested as a standard feature in Autogenerated entries: allow image override per entry #7844, but without a clear RFC
- Implemented in feat(theme): allow custom icons in DocCard component #11596, but without a clear RFC
- This Canny request likely refers to the same thing: https://docusaurus.io/feature-requests/p/defining-default-imageicon-lightdark-for-standalone-pages-and-categories
There are additional motivations to implement it:
- The current solution for implementing custom icons is quite hacky (in my opinion), requiring
npm run swizzle @docusaurus/theme-classic DocCard -- --eject. - The code required to add custom emojis is small.
- The changes proposed are entirely backwards compatible.
API design
I'll first list the API, then list all the reasons why other options were discarded.
This option introduces the option doc_card_emoji, which can be provided as an emoji to overwrite the default icon taken for the cards when using the automatic card generation with <DocCardList />. Only emojis are to be accepted on this field.
Here are the locations where this option can be added:
- Markdown front matter: The front matter accepts this option to customize the cards. Example:
---
id: croissant
title: Croissant
doc_card_emoji: 🥐
---
# Croissant
The croissant is a flaky, buttery pastry shaped like a crescent. It's made from laminated dough...- Prop for CardLink, CardCategory (internally), exposed via prop on DocCard: allows the customization by calling the card directly, via the prop
icon. This is done to respect the naming convention of theCardLayoutcomponent. This means you can also render custom emojis when callingDocCarddirectly from an mdx page.
Optionals to be additionally approved for more uniform behaviour (in discussion):
Optional part for the RFC: when providing the option doc_card_emoji, you can additionally set it to false to remove the icon completely from card. This should allow anyone to also add icons to the sidebar, similarly to how it is done on the plugins page. This would then be featured on both the card and the sidebar. Example:
```md
---
id: croissant
title: 🥐 Croissant
doc_card_emoji: false
---
# 🥐 Croissant
The croissant is a flaky, buttery pastry shaped like a crescent. It's made from laminated dough...Optional part for the RFC: rename the prop on the CardLayout component from icon to emoji to prevent misunderstanding why an icon (SVG or PNG) cannot be passed (see discussion below). Since the CardLayout is not a default export, this should be feasible.
The current behaviour already splits the functionality of the card and the sidebar
I'll quote the comment from #7844 (comment):
We could add icon to sidebar items, icon in category.json, and sidebar_icon front matter in docs.
However, wouldn't this be confusing if we could only pass emojis as icons? Also, how do you control what is displayed on the generated index? My intuitive expectation would be that the icon also shows on sidebar items, and not just the generated index. Do we need to create 2 options to decouple the 2?
This is already not the case. Currently, all rendered DocCard have icons (or emojis) independent of the sidebar option.
Sidebar icons can be inconsistent if done in single items
We have tried to come up with a concept of enabling/disabling the sidebar icons independently of each other, but we have came to a couple of problems:
- Having individual icons appearing on the sidebar looks very inconsistent:
- Having the default icons appearing on the sidebar would not only break current behaviour. It also looks very inconsistent too:
Adding sidebar icons is already allowed
This has been used, for example, on the plugins page. If you include the emoji on the text, you are already able to add the icons to the sidebar:
But there are limitations, for example, the plugins have to be listed manually. If you list them via the DocCardList, they would have two emojis instead. Here is how they are currently displayed:
Enabling sidebar icons globally could be a reasonable option
Having a global option that enables icons in the sidebar would perhaps be acceptable, having this sidebar "inheriting" the card emoji.
But having a sidebar full of different emojis isn't the most aesthetically pleasing. I (personally) found the sidebar quite polluted - if the icons are all the same (defaults), the emojis serve no purpose, if they are all different, then sidebar looks inconsistent.
I'm pretty sure there are particular cases where this could be done, but as noted before you can already do it by using a custom name for the sidebar with an emoji.
As also noted, there are multiple ways to provide custom sidebar options, but this RFC focus on the simplicity of only changing the card icon.
Have you tried building it?
As mentioned, this feature has already been built in #11596, but the design has some flaws.
If it is approved, I'm willing to contribute the code.
Acknowledgements
This RFC was discussed during the 13/01 Hackergarten in Stuttgart. Special thanks to the following people:
I hope this overview is understandable! Let me know what you guys think.
Self-service
- I'd be willing to contribute this feature to Docusaurus myself.
Activity
lab596 commentedon Feb 1, 2026
Hey there! Unassociated 3rd party weighing in here for curiosity's sake.
I was hoping to better understand the technical scope regarding the difference between emojis and image-based icons (SVGs/PNGs) for this specific implementation.
1. The Serialization Hurdle: Emojis vs. Assets
Based on my understanding so far, sidebar data needs to be serialized and sent to the browser as a JSON file. This makes emojis incredibly easy to support since they are just text strings. However, asset files like SVGs or PNGs are much more difficult because they would require the data pipeline to handle path resolution, bundling, and dynamic imports.
Is the goal of this RFC to strike a compromise and ship only emoji support (since it's technically lightweight), even if it leads to some inconsistency for users who want branded icons?
2. Cards vs. Navigation
From an opinionated UX perspective, proper graphical icons fare much better in dense navigational components (like the Sidebar) than standard emojis do.
While I understand the desire to achieve unison between the Sidebar and the Card display, I believe the Sidebar requires proper icon support to look professional. As you mention, having random emojis in the Sidebar can look messy and inconsistent.
A Potential Compromise:
Perhaps a disconnect between the two components should be accepted for now?
Going the "full mile" would obviously include universal icon support for both, but decoupling them might solve the immediate Card issue without ruining the Sidebar's UI.
Would appreciate your thoughts on whether this disconnect is a viable path forward.
slorber commentedon Feb 12, 2026
Until we have a proper solution to this problem, would a workaround to deduplicate the 2 emojis be good enough?
See proposed solution here: #11734
I'm not a fan of introducing an emoji-based front matter / API because, emoji is part of the string already. I'd like to go how far we can go without introcuding such API.
If we do this, apart from SVG/JSX icons that we'd still want to support, do you encounter any limit with emojis?
bvanelli commentedon Feb 13, 2026
@slorber I do like the solution of de-duplicating emojis. Either way, this:
My only concern is the inconsistency problem (see below).
You mean adding the emoji to the card as a prop (also via the TSX header configuration props)?
The problem with dealing with it as part of the text is that just having a single emoji on the sidebar looks weird, and you don't want to suddenly have many.
If, for example, you ONLY show emojis in the sidebar when they are present in the text, it can look inconsistent on the sidebar (for single emojis), but that is what you wanted as a developer by introducing them in the text.
If we go this way, without implementing the
DocCardprops, would it make sense to have astripPrefixEmojisoption that removes all emojis from the sidebar index? This would be very helpful in my opinion for dealing with the inconsistency discussed inSidebar icons can be inconsistent if done in single items.Or maybe having individual icons on the sidebar does look consistent, and I'm just imagining things? Maybe someone else can vote on the following example in my comment (thumbs up or thumbs down) on whether this looks consistent:
If multiple people agree this is consistent, we can directly go with this option.
I don't see any limitation. Emojis have no usage barrier — no imports, no special code needed, no files to download and place anywhere. There is no barrier to usage, even if you are not technically inclined. There are also hundreds of them to use.
I personally wouldn't go to the effort of configuring custom SVG/JSX icons simply because it's not that straightforward (install packages, design SVG files, etc.).
If someone else is interested in SVG/JSX icons, let your voice be heard in this issue.
slorber commentedon Feb 13, 2026
Yes, looks weird
Why not? 🤷♂️
Honnestly I'm not sure to understand how this is a problem at all. People who want emojis usually use them consistently on all sidebar items of a given category, doc titles, and doc cards, or don't use any emojis at all.
Whether it's an icon (SVG, React), a text emoji, an image, or whatever, it would be weird to only use one on a single element, and leave all the others with no icon at all, or the default emoji. Even on the genenerated index, it doesn't make sense to have one item with 🐍, and all the others being 📁.
For that reason, it would be helpful to share the concrete outcome you want as an example, instead of starting with a possible API design. If we have enough concrete and detailed examples, they can be used as test cases, and we can design an API to fulfill them all.
Please show us visually what you want to achieve, that is consistent and looks good, for all these 3 things:
From my perspective, I don't think it would be visually pleasant to have a single icon. On a given sidebar level, you'd likely want to have icons (preferably distinct) for all items, or none of them.
I do believe it could remain useful to decouple what appears on the docs sidebar from what appears on the generated index page, though. But I don't think this should take the form of an emoji/icon API, and would prefer to introduce a more flexible front matter:
This would allow to:
We have already seen sites implementing custom SVG/JSX icons on their own means, so there's definitely a demand for this.
Hasura: https://hasura.io/docs/
Note: You can see here that all the top-level categories use distinct icons.
Same for Piano: https://developers.piano.io/analytics/data-collection/general/how-it-works/
Dyte: https://docs.dyte.io/guides
Note: you can see here that all the items of the same "group" have distinct icons or do not have icons (all or nothing)
slorber commentedon Feb 13, 2026
I have split the DocCard component into multiple smaller parts in #11734
If the sidebar item label starts with an emoji, it will be automatically extracted and used in place of the default emojis we provide. It will also be rendered into a separate element, enabling us to customize the layout/display of that emoji (we made it slightly bigger).
For further customization needs, there's now a component dedicated to the icon:
It also receives the "item" as props (although here it's not used), so it's relatively easy to eject or wrap it and add custom logic, read the item custom props to create your own custom emoji front matter (see tuorial/demo), or resolve the emoji or a custom name to an actual SVG or React component.
I'm going to consider that the "emoji" feature is implemented, and close this PR because most emoji usages should be relatively easy to achieve. If you have a use-case that is not easy, please give a concrete example, and we'll either provide a solution or we'll consider enhancing the default system we provide.
It's not really related to emojis, but we may still want to:
generated_index_{title,description}front matter to decouple from the sidebar labelIf you are interested in these features, please open a separate proposal / RFC with a clear example of the result you want to obtain.
bvanelli commentedon Feb 13, 2026
Thanks for the updates here @slorber