Skip to content

[6.4] Add extension points to documentation components - #1028

Merged
marinaaisa merged 2 commits into
swiftlang:release/6.4.xfrom
mportiz08:6.4/added-slots
Sep 11, 2026
Merged

marinaaisa merged 2 commits into
swiftlang:release/6.4.xfrom
mportiz08:6.4/added-slots

Conversation

@mportiz08

Copy link
Copy Markdown
Member

Explanation: Adds extension points to 2 documentation components
Scope: Added slot below documentation abstract, added slot for aside title
Issue: rdar://176906827
Risk: Low, only added slots. No change to existing behavior—just extension points that can be overridden
Testing: Added unit tests, manually checked that there are no visual regressions
Reviewer: @mportiz08
Original PRs:

@mportiz08
mportiz08 requested a review from franklinsch August 14, 2026 22:24
@mportiz08
mportiz08 requested a review from marinaaisa as a code owner August 14, 2026 22:24
@marinaaisa

Copy link
Copy Markdown
Member

@swift-ci test

@marinaaisa

Copy link
Copy Markdown
Member

@swift-ci test

@marinaaisa
marinaaisa marked this pull request as draft August 18, 2026 17:42
…wiftlang#1017)

Without a slot between the Abstract and the elements that follow it,
consumers of DocumentationTopic have no way to inject custom content
immediately after the page description. The only option would be to
override or fork the entire component, which is fragile and breaks on
upstream updates.

A new named slot `below-abstract` [1] is added directly after the
`Abstract` component and before the `v-if="sampleCodeDownload"` div.
This placement means content projected into the slot appears below the
page description but above the download button, availability badges, and
declarations, keeping it logically grouped within the introductory part
of the hero without interfering with any of the surrounding
conditionally rendered elements.

A test is added to verify that content projected into the slot is
rendered inside the DocumentationHero component at the expected
location.

[1] https://vuejs.org/guide/components/slots#named-slots
The label rendered inside the Aside component was hardcoded as a plain
<p class="label"> element with no extension point. Any consuming
component that needed a different label presentation, or no label at
all, had no way to achieve that without adding a new special-cased prop
or a new kind value just to toggle the element off.

Vue's named slots with fallback content [1] are the best solution here:
the slot renders its default content when the parent provides nothing,
preserving all existing behaviour exactly as before, while still giving
any consumer the freedom to supply its own label markup or suppress the
label entirely by providing a non-rendering element (e.g. <span />) in
the #label slot.

The <p class="label"> is now wrapped in <slot name="label">…</slot> so
that it continues to act as the default for every current usage of
<Aside> (ContentNode, DocumentationTopic, etc.), and a new test
documents and verifies the override path.

[1] https://vuejs.org/v2/guide/components-slots.html#Fallback-Content
@marinaaisa

Copy link
Copy Markdown
Member

@swift-ci test

@marinaaisa
marinaaisa marked this pull request as ready for review September 10, 2026 17:13
@marinaaisa

Copy link
Copy Markdown
Member

@swift-ci test

@marinaaisa
marinaaisa merged commit d45c3ac into swiftlang:release/6.4.x Sep 11, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants