1. How swift-docc-render consumes this
A callToAction section is one of the possible entries in the top-level sections
array of a tutorial-page or tutorial-article-page RenderNode. It is dispatched in two places, both of which
ultimately delegate to the same underlying component:
-
Tutorial pages —
components/Tutorial.vuebuilds aSectionComponentslookup table keyed by sectionkindand mapscallToActionstraight tocomponents/Tutorial/CallToAction.vue. See Tutorial.vue#L46-L66 for the dispatch table and the genericTutorialSectionrender function that instantiates the matched component with the section's own properties spread onto it. -
Tutorial-article pages —
components/Article.vuekeeps a parallelSectionKind/componentFor()/propsFor()trio.componentFor()mapscallToActiontocomponents/Article/CallToAction.vue(Article.vue#L113-L121), andpropsFor()extracts exactlyabstract,action,media, andtitlefrom the raw section object to pass down as props (Article.vue#L142-L151).
Both wrapper components are thin: Article/CallToAction.vue simply re-exports
Tutorial/CallToAction.vue's props and renders <TutorialCTA v-bind="$props" />
(Article/CallToAction.vue#L11-L24),
and Tutorial/CallToAction.vue itself only adds a fixed, localized button label
($t('tutorials.next')) before forwarding everything to the true base implementation,
components/CallToAction.vue:
<template>
<BaseCTA
v-bind="baseProps"
:label="$t('tutorials.next')"
/>
</template>
(Tutorial/CallToAction.vue#L11-L23).
Notably, Article/CallToAction.vue re-exports the same props object — which marks
label as required — but Article.vue's propsFor() never supplies a
label value for article-page call-to-actions, so on tutorial-article pages the button ends up
with an undefined label unless Vue's prop-required warning is otherwise suppressed; only the
Tutorial-page path reliably supplies "Next".
The real template lives in components/CallToAction.vue. Its root element is
<div class="call-to-action">, containing a GridRow/GridColumn
two-column layout: the left column renders an eyebrow <span class="label">, an
<h2> title, an optional abstract (wrapped in a synthetic paragraph node and handed to
ContentNode), and an optional CallToActionButton; the right column renders an
optional Asset for the media identifier:
<div class="call-to-action">
<Row>
<LeftColumn>
<span class="label">{{label}}</span>
<h2> {{ title }} </h2>
<ContentNode v-if="abstract" class="description" :content="[abstractParagraph]"/>
<Button v-if="action" :action="action" />
</LeftColumn>
<RightColumn class="right-column">
<Asset v-if="media" class="media" :identifier="media"/>
</RightColumn>
</Row>
</div>
(CallToAction.vue#L11-L25).
The Button child is CallToActionButton.vue, which resolves the action
(a RenderInlineContent.reference) through DestinationDataProvider to get a
url/title pair and renders a ButtonLink
(CallToActionButton.vue#L11-L21).
Functionally, this section is DocC's own auto-generated "what's next" panel at the bottom of a tutorial or
tutorial-article page — it is not something an author writes with a Markdown directive. The Swift-DocC
converter side (RenderNodeTranslator.callToAction(with:volume:) and
createCallToAction(reference:kind:title:abstract:image:) in
Sources/SwiftDocC/Model/Rendering/RenderNodeTranslator.swift) walks the learning path for the
current tutorial's volume, finds the next tutorial or tutorial article, and synthesizes this section with a
title/abstract copied from that next page, a media reference to its intro image if any, and an
action that is an active .reference whose overridingTitle is either
"Get started" (next item is a tutorial) or "Read article" (next item is a tutorial article).
See also: The references map — how this and every other reference-dictionary lookup works across kinds.
See also: Localization fallback — how $t()/locale-key lookup works across every kind that uses it.
2. Example JSON and rendered mockup
No raw JSON fixture containing a callToAction section was found in
DocCArchive/Tests/DocCArchiveTests/Fixtures/ (only minified JS bundle hits, not RenderNode JSON)
or as a standalone JSON file in swift-docc/Tests/SwiftDocCTests/. Swift-docc's own test suite does
exercise this kind, but only via Swift struct literals asserted against decoded values (see
SemaToRenderNodeTests.swift around the guard let callToAction = renderNode.sections.last as?
CallToActionSection check). The example below is a synthetic JSON document, but its field values
(title, abstract text, media identifier, action identifier, and overridingTitle) are taken
directly from that real test's assertions so the shape and content are faithful to actual DocC output.
{
"kind": "callToAction",
"title": "Making an Augmented Reality App",
"abstract": [
{ "type": "text", "text": "This is an abstract for the intro." }
],
"media": "introposter2.png",
"action": {
"type": "reference",
"identifier": "doc://org.swift.docc.example/tutorials/Test-Bundle/TestTutorialArticle",
"isActive": true,
"overridingTitle": "Read article",
"overridingTitleInlineContent": [
{ "type": "text", "text": "Read article" }
]
}
}
This is an abstract for the intro.
Read article3. Data sheet
| Field | Type | Required | Enum / default | Note |
|---|---|---|---|---|
kind |
string | yes | enum: "callToAction" |
Discriminator; see RenderNode.spec.json CallToActionRenderSection and generated
KindPayload enum. |
title |
string | yes | — | Title copied from the destination (next tutorial/article) page. |
abstract |
array of RenderInlineContent |
no (spec/generated types mark it optional) | default: absent → empty in practice | Wire schema/generated Swift type has this as [RenderInlineContent]?. Note: the pinned
swift-docc struct CallToActionSection (commit 8b8d8268aa) instead declares it non-optional
([RenderInlineContent] = []) and decodes missing input as [] — same effective
behavior, different optionality on the wire-schema side. This is likely because the vendored spec in this
repo is pinned to a different upstream commit (5915e66d…, "6.3-nightly" per
VendorVersion.swift) than the swift-docc checkout used for this page's step-3 sourcing. |
media |
string | no | — | Wire value is a plain string identifier (a key into the RenderNode's references dictionary),
not an inline media object. Rendered by resolving it through Asset.vue's identifier prop. |
action |
RenderInlineContent (single object, not array) |
yes | — | In practice always a .reference variant of RenderInlineContent pointing at the
next tutorial/tutorial-article, with an overridingTitle of "Get started" or "Read article". |
featuredEyebrow |
string | no | — | Present on the Swift struct CallToActionSection at the pinned swift-docc commit (holds
"Tutorial" or "Article"), but this field is absent from this repo's vendored
RenderNode.spec.json and from the generated CallToActionRenderSection Swift type —
another symptom of the vendored-spec/swift-docc version skew noted above. Any archive produced by a DocC
version that emits featuredEyebrow will have that value silently dropped by DocCArchive's
current generated decoder. |
Sources: Sources/DocCArchive/Vendored/RenderNode.spec.json lines 139-167 (schema object
CallToActionRenderSection); Sources/DocCArchive/generated/Types.swift lines
3171-3215 (generated struct Components.Schemas.CallToActionRenderSection); swift-docc struct
CallToActionSection at
CallToActionSection.swift#L14-L57.
4. HTML/CSS mapping in DocC-Render output
Rendered markup from components/CallToAction.vue:
div.call-to-action— root wrapper; vertical padding and a themed background.div.row(fromGridRow) — flex row, centered items; becomesdisplay: blockat thesmallbreakpoint.div.col×2 (fromGridColumn, via the inlineLeftColumn/RightColumnrender-function components) — left column spans 5/12 large-grid columns (12/12 on small), right column spans 6/12 (12/12 on small) withclass="right-column"additionally pushing itself to the far right (margin-left: auto).span.label— the eyebrow/button-label text (e.g. "Next" on tutorial pages).h2— the section title, styled via theheading-2font-style mixin.div.description(aContentNodeclass hook) — the abstract paragraph.a/ButtonLinkmarkup (fromCallToActionButton.vue→ButtonLink.vue) — the action button, not a raw<button>.div.media(anAssetclass hook) insidediv.right-column— the optional image/video.
SCSS lives inline in each .vue file's <style scoped lang="scss"> block. The
relevant rules are in
CallToAction.vue#L109-L160
and, for the article-specific breakpoint tweak, in
Article/CallToAction.vue#L26-L34.
CSS custom properties consumed: --color-call-to-action-background (overridden to
rgb(66, 66, 66) under .theme-dark), --color-eyebrow,
--spacing-stacked-margin-small. The section also imports the shared
docc-render/styles/_core.scss partial for the breakpoint,
breakpoint-content, and font-styles mixins used above.
5. Modern CSS-only alternative
Not applicable
Current JS/Vue behavior: components/CallToAction.vue is a stateless presentational component —
it has no internal reactive state, no toggled visibility, and no client-side interaction of its own. It
receives title/abstract/media/action/label
as props and renders them straight into a two-column grid layout every time; CallToActionButton.vue
resolves the destination URL through DestinationDataProvider at render time and emits a plain
<a>-based ButtonLink — clicking it is normal browser navigation, not a
JS-driven state change. The one piece of client-side interactivity anywhere near this component,
Hero.vue's callToActionModalVisible data flag controlling a modal, belongs to the
unrelated tutorial Hero section, not to callToAction sections.
Because there is no interactive state to reproduce (no tabs, no expand/collapse, no conditional visibility
driven by user input), there is no native HTML/CSS mechanism to name here — the section is a static,
server/build-time-rendered content block whose only "logic" is conditional presence of optional fields
(abstract, action, media), which plain v-if/absence-in-HTML
already covers with no client behavior to replace.