ComponentsCode blocks

content@texuli/blocksagent-emittablecontent

Code blocks

blocks-code

Validated, highlighted code.

Live examples

Code blocks example

Code blocks example

Loading demo…

Props

Public props for Code blocks
NameKindRequiredDefaultDescription
blockobjectyes—Untrusted block data validated by the component before rendering.
labelsobjectno——
oninvalideventno—Host-provided callback; omit when no host behavior is needed.
lineNumbersbooleanno——
highlightsarrayno——
hostStepnumberno——
stepnumberno——
copyablebooleanno——

Keyboard

Keyboard behavior for Code blocks
KeyAction
—See accessibility notes for keyboard behavior.

Accessibility

  • Provide the required accessible title, description or text alternatives.
  • Keep data available in the component-provided text or table alternative.

Evidence for blocks-code

Latest committed gates for blocks-code (as of 2026-10-23). Static snapshot — not live CI.

Behavior

n/ano behavior scenario

No dedicated behavior scenario for this catalog id (a styled or display surface, covered by its unit and axe tests).

Size (gzip)

@texuli/blocks/blocks-code · budget 20.0 KiB

Budget from texuli.budgets.json; re-measure with `pnpm size --filter <entry>`.

Axe

documented

  • tests/e2e/site-component-pages.spec.ts
  • docs/quality (a11y-*)

Site component pages axe gate; package-level a11y docs under docs/quality when present.

Browsers

  • chromium
  • webkit
  • mobile

Playwright projects: Desktop Chrome, Desktop Safari, Pixel 7. Firefox is a known gap on this host.

When to use

Use when

  • Render code blocks from structured content data.

Don’t use when

Prefer another component

  • Application navigation, account controls or mutations.