data-display — wyrd.component.code-block

CodeBlock

Read-only source display with optional filename chrome and line numbers.

Install @wyrd-company/react or the Flutter package and use it directly — your DESIGN.md does the styling.

01

Examples

Generated from the contract's examples block. Previews are the published @wyrd-company/react component, themed by the brand's role tokens — flip the site's light/dark toggle and they follow.

Code target Applies to every example on component pages.
yaml-contract state: default
button.ymlyaml
identity:
  name: Button
Usage
import { WyrdCodeBlock } from "@wyrd-company/react";

<WyrdCodeBlock source="identity:
  name: Button" language="yaml" filename="button.yml" showLineNumbers />
plain state: default
bash
pnpm run build
Usage
import { WyrdCodeBlock } from "@wyrd-company/react";

<WyrdCodeBlock source="pnpm run build" language="bash" filename="" showLineNumbers={false} />
02

Properties

NameTypeDefaultSummary
source string undefined Source text rendered verbatim.
language string text Language identifier exposed for syntax-highlighting adapters.
filename string Optional source filename shown in the header.
show-line-numbers boolean true Whether each source line carries a visible line number.
03

Tokens

The contract's token bindings. Open the shared contextual sidebar from any example; primary swatches reflect the color you pick there. Error swatches show the active preset's values; editing any knob switches to custom and resets error to TWW · Ink.

BindingToken
background color.surface-fixed
foreground color.on-surface-fixed
border-color color.outline
accent color.accent
radius rounded.md
padding spacing.md
04

States

StateSourceSummary
default platform Source is visible in a fixed dark surface.
05

Accessibility

From the contract's accessibility obligations. Role none

  • Uses native pre and code semantics on web.
  • Line numbers are hidden from assistive technology and source text remains copyable without gutter content.
  • Language and filename are supplemental metadata, not the accessible name of the source.
  • Verified under: rtl, density-compact, text-expansion.
06

SDUI

Status: serializable. CodeBlock serializes its source and display metadata.

SerializableMembers
Propertiessource, language, filename, show-line-numbers
Slots
Events
The Wyrding Way — a contract-first design system. © Wyrd Company