-
-
Notifications
You must be signed in to change notification settings - Fork 530
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
Clarify how to override default components that use multiple slots. #2386
base: main
Are you sure you want to change the base?
Conversation
The documentation lacked an explanation of how to override default components that use named slots. Passing all slots through is necessary. Omitting this step breaks the layout for example when user conditionally changes PageFrame.astro. The commit adds an explanation and a code example.
|
✅ Deploy Preview for astro-starlight ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
Hello! Thank you for opening your first PR to Starlight! ✨ Here’s what will happen next:
|
Lunaria Status Overview🌕 This pull request will trigger status changes. Learn moreBy default, every PR changing files present in the Lunaria configuration's You can change this by adding one of the keywords present in the Tracked Files
Warnings reference
|
Thanks for your contribution 🙌 This is definitely something that we do not explicitly document and has come up a few times already. I'd like to get other people's opinion on this but my initial thought would be that this would better fit in the "Reuse a built-in component" section rather than the "Use page data" one. I'm also not sure we would need an entire new code example for this as this would be mostly identical to other ones we already have but we could link to the relevant Astro Docs section. I think my idea would be to add a third bullet point to the "Reuse a built-in component" unordered list that could look something like this:
Another possibility that comes to mind is to reference additional named slots in the "Overrides Reference" page for the few components that have them. At the moment, only For example, below the "Default component: TwoColumnContent.astro" line, it could say:
Like I said, I'd like to get your and other people's opinion on this before making any changes. Let me know what you think. |
Thanks @HiDeoo for reviewing the proposed change. I agree that the information fits better as a third bullet point under Reuse a built-in component. Also referencing the named slots in the Overrides Reference makes sense to me as most users probably won't check in the overridden file in depth and would appreciate a hint that they need to handle the slots. I'll wait for others' opinions as well and proceed with your suggested change in this PR if I don't hear otherwise. |
Hey @HiDeoo. As I haven't heard any other opinions on that I've made the suggested changes:
|
The documentation lacked an explanation of how to override default components that use named slots. Passing all slots through is necessary. Omitting this step breaks the layout for example when user conditionally changes PageFrame.astro.
The commit adds an explanation and a code example.