-
-
Notifications
You must be signed in to change notification settings - Fork 613
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
Support component customisation #709
Conversation
🦋 Changeset detectedLatest commit: 98b80e0 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
✅ Deploy Preview for astro-starlight ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
size-limit report 📦
|
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.
can't wait to use this 🥳
Starlight is awesome, I'm rather enjoying it but still learning. I'd love to see the documentation for overriding the PageFrame.astro component, specifically how to preserve the named header slot. |
Update: I think I figured it out. Really loving Starlight :) <3
|
What kind of changes does this PR include?
Description
Support “slots” — spaces in the layout where no default component is rendered but users can add custom UICancelled for now after some discussion — let’s see if we can make an override-only system as nice as possible!Docs preview →
How will this feature work?
There’s a new
components
option in Starlight config where users can provide a component to override one of Starlight’s built-in components inastro.config.mjs
:Components used to override a built-in component can import types to get type-safe props. These are consistent across all components available to override:
Components can import the default implementation if they want to just add some DOM alongside the existing UI:
Most components don’t require
<slot />
, but some do, so I’m thinking this pattern should be what we document for consistency.<PageFrame />
uses named slots, which might need extra documentation. Looked at refactoring it to avoid using them, but I think it would lead to worse code structure.