Add TableOfContentsList to Module Exports / Allow Overrides #2071
Replies: 1 comment 1 reply
-
Thanks for the suggestion @jumpingpxl! The main reason this isn’t available to override is that our overridden components all share the same props interface, but the It should already be possible to render extra links etc. below the table of contents. Here’s an example of overriding the table of contents and adding a custom link below. ---
import type { Props } from '@astrojs/starlight/props';
import Default from '@astrojs/starlight/components/TableOfContents.astro';
---
<Default {...Astro.props}><slot /></Default>
<a href="mailto:[email protected]">Send us an e-mail</a> For people who do want to reimplement |
Beta Was this translation helpful? Give feedback.
-
What version of
starlight
are you using?0.24.4
What is your idea?
My Idea is to add TableOfContentsList to the module exports of starlight. Also adding TableOfContentsList to the components supporting overrides would be good
Why is this feature necessary?
Adding the TableOfContentsList component to the module exports would make it possible to override the TableOfContents component without having to import the TableOfContentsList component by its relative path (f.e.
../../../node_modules/@astrojs/starlight/components/TableOfContents/TableOfContentsList.astro
). Overwriting the TableOfContents would allow us to add extra links, etc below the TableOfContents.Adding the ability to overwrite TableOfContentsList would allow us to change the general structure of the component. f.e. to remove the nesting
Do you have examples of this feature in other projects?
No response
Participation
Beta Was this translation helpful? Give feedback.
All reactions