Replies: 2 comments 1 reply
-
|
I'd like to hear from individual users on their use cases before we do anything like this. I can see the following options as a possibility:
If we did allow icon customization, we would need to allow the user to use their own icon. We should not take icon requests for our icon library or it will be difficult to maintain. The methods described above can work. A good start might be to use class names that are human readable to make the pseudo element trick easier and more obvious. |
Beta Was this translation helpful? Give feedback.
-
|
If a theming overhaul would fix this, I would prefer to do it that way rather than increase our API surface area. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Summary
The sidebar allows users to customise React nodes for the text portion of a sidebar item via
renderLabel. With a11y compliance, we also need to addrenderAriaLabelfor a screen-reader counterpart.There are weak signals in favour of allowing the customisation of
renderIcon. This RFC asks the question of whether we should decide to add this additional API endpoint.Problem Statement
Sidebar item text can be customised, but not the icons. Icons always depend on the item [sub]type (group, component, docs, story, test).
In Storybook 10, users can create their own content types (for which they may want custom icons). They need to use a pseudo element positioned over the actual icon to handle this use case. Reported use cases are:
tabaddon type, that lets users add custom content to a specific sidebar entry; as we remove this in SB11, the alternative for this would be custom indexersBesides, themability would be simplified if we added
renderIcon. At the moment and until theming 2.0 is implemented, it is difficult to change the colours of icons. It's difficult to target a specific type of icon (#18336).Non-goals
No response
Implementation
Option 1 - do not add API endpoint:
Option 2 - add endpoint:
sidebar.renderIconendpointPrior Art
sidebar.renderLabel, which is primarily useful for badges/status addonsDeliverables
No response
Risks
There is very little direct user demand for this. The needs where it would come handy are fairly niche, with little demand as well. Even though the maintenance surface is reasonable (we already have
renderLabelworking identically), the ROI is difficult to justify.Unresolved Questions
Alternatives considered / Abandoned Ideas
No response
Beta Was this translation helpful? Give feedback.
All reactions