Site color

Choose your site’s color palette.

Saved on this device.

CodeShowcase

CodeShowcaseCode and result

Pair a code block with its visible result and the context needed to understand both.

Landing & pricing

Code and its result

Write a normal fenced code block in the default slot. ts-ssg highlights it automatically; the result slot renders the matching component.

CodeShowcase in contextCOMPOSITION
A SMALL EXAMPLE

Semantic status

One component, one clear message.

MDX
    <Badge tone="success">Ready</Badge>
Rendered result Live component
Ready

Compare the composition, then open its source tab to adapt it.

<CodeShowcase
  eyebrow="A SMALL EXAMPLE"
  title="Semantic status"
  summary="One component, one clear message."
  language="MDX"
  resultTitle="Rendered result"
  resultMeta="Live component"
  tone="accent"
>

```html
<Badge tone="success">Ready</Badge>
```

  <template #result>
    <Badge tone="success">Ready</Badge>
  </template>
</CodeShowcase>

A focused code note

Omit resultTitle and resultMeta when a result panel is unnecessary.

A named value

TypeScript
const releaseName = 'Preview'
<CodeShowcase title="A named value" language="TypeScript" variant="outline">
  <pre><code>const releaseName = 'Preview'</code></pre>
</CodeShowcase>

All ten semantic tones

The same composition in every semantic tone. Child tones are explicit where the composition owns them, including navigation actions.

All ten semantic tonesCOMPOSITION

Switch the site theme to compare the same samples in both palettes.

All eighteen visual variants

Every supported variant is shown in accent, including none. Variant controls the outer treatment; nested content may use its own treatment.

All eighteen visual variantsCOMPOSITION

Switch the site theme to compare the same samples in both palettes.

Result panel conditions

Code alone, a title, or result metadataCOMPOSITION
Code only

A named value

No result panel needed.

TypeScript
const status = 'ready'
Result title only

Status label

<Badge>Ready</Badge>
Preview
Ready
Result metadata only
ONE COMPONENT

Inline status

<Badge>Ready</Badge>
Live
Ready

Either resultTitle or resultMeta enables the result slot. language is a visible badge; syntax highlighting comes from MDX fenced code.

Feature map

Public feature Visible example
tone, variant Complete galleries above, with all supported values visible together.
eyebrow, title, summary The original code-and-result example introduces the purpose of the snippet.
language MDX and TypeScript badges label the snippets; the title-only result sample omits the language badge.
resultTitle, resultMeta Compare code-only, title-only result, metadata-only result, and the original result with both fields.
Default and result slots The default slot holds code; the named result slot holds live rendered content. A result heading or metadata is required to show that panel.
Native attributes and events Pass attributes through the root; keyboard behavior belongs to the composed native controls.

This component exposes tone and variant, but no variantMode. Style individual child components explicitly when their appearance should match.

Behavior and accessibility

The language prop is a badge, not a syntax-highlighting engine. ts-ssg highlights fenced code in MDX automatically. A result slot is rendered only when resultTitle or resultMeta is present. Keep results keyboard-accessible when they contain controls.

API reference

CodeShowcase contract

Props below are the public template API. RefOrValue accepts a literal or a reactive ref; bind refs with a colon-prefixed attribute. Native attributes and events can be passed through the component root.

eyebrow

RefOrValue<string>
Default
not set

Short context above the heading, such as a category or release label.

title

RefOrValue<string>
Default
not set

Visible heading. Choose a short title that identifies the content or task.

summary

RefOrValue<string>
Default
not set

A concise explanation beneath the heading.

language

RefOrValue<string>
Default
not set

Language label displayed in a Badge. It does not transform source text.

resultTitle

RefOrValue<string>
Default
not set

Result heading. Setting this or resultMeta enables the result panel.

resultMeta

RefOrValue<string>
Default
not set

Result status or metadata badge. Setting this or resultTitle enables the result panel.

tone

RefOrValue<SemanticTone>
Default
inherited

Semantic intent: neutral, accent, secondary, info, success, warning, danger, feature, custom or ghost. The active skin supplies the colors.

variant

RefOrValue<ComponentVariant>
Default
surface

Visual treatment. Accepts solid, surface, surfaceAlt, spotlight, glass, flat, flatAlt, flatSolid, outlineFill, outline, subtle, subtleBtn, link, sheen, underline, rail, bracket or none.

Composition

Default slot: code or other explanatory content. result: rendered example. Register defineCodeShowcaseComponent with Panel, Flex, SectionHeader and Badge.