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.
catalog/contracts/code-block.ymlsource of truth · verbatim
$schema: https://thewyrdingway.dev/schemas/component-contract.schema.ymlcontractVersion: 0.1.0identity:name: CodeBlocktag: wyrd-code-blockpackage: wyrd.component.code-blocktitle: Code blocksummary: Read-only source display with optional filename chrome and line numbers.relationships:related-to: - quality-parity-and-gatesclassification:category: data-displaycomposition: leafinteractive: falsetarget-strategy:react: requiredflutter: requiredsurface:properties: - name: sourcetype:kind: stringrequired: trueserializable: truesummary: Source text rendered verbatim. - name: languagetype:kind: stringrequired: falsedefault: textreflects: trueserializable: truesummary: Language identifier exposed for syntax-highlighting adapters. - name: filenametype:kind: stringrequired: falsedefault: ""reflects: trueserializable: truesummary: Optional source filename shown in the header. - name: show-line-numberstype:kind: booleanrequired: falsedefault: truereflects: trueserializable: truesummary: Whether each source line carries a visible line number.slots: []events: []states: - name: defaultsource: platformsummary: Source is visible in a fixed dark surface.parts: - name: rootsummary: Fixed-surface figure. - name: headersummary: Optional filename and language chrome. - name: codesummary: Verbatim source text. - name: line-numbersummary: Repeated line-number gutter.tokens:background: color.surface-fixedforeground: color.on-surface-fixedborder-color: color.outlineaccent: color.accentradius: rounded.mdpadding: spacing.mdmessages: []obligations:accessibility:role: nonekeyboard: []semantics: - 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.behavior:model: statelessinteractions: []hostEffects: []conditions: - rtl - density-compact - text-expansionsdui:status: serializableserializableProperties: - source - language - filename - show-line-numbersserializableSlots: []eventBindings: []notes: CodeBlock serializes its source and display metadata.examples: - name: yaml-contractstate: defaultproperties:source: "identity:\n name: Button"language: yamlfilename: button.ymlshow-line-numbers: trueslots: {} - name: plainstate: defaultproperties:source: pnpm run buildlanguage: bashfilename: ""show-line-numbers: falseslots: {}
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.
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.
Binding
Token
background
color.surface-fixed
foreground
color.on-surface-fixed
border-color
color.outline
accent
color.accent
radius
rounded.md
padding
spacing.md
04
States
State
Source
Summary
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.