---
id: portfolio.ds.reply-code-block
name: "Reply Code Block"
type: component
status: active
relations: [{"type":"uses_token","target":"portfolio.ds.typography"},{"type":"uses_token","target":"portfolio.ds.color-text-contrast"},{"type":"uses_token","target":"portfolio.ds.color-background-contrast"},{"type":"uses_token","target":"portfolio.ds.medium-corner-radius"},{"type":"uses_token","target":"portfolio.ds.primitive-scale"},{"type":"uses_token","target":"portfolio.ds.focus-interaction-states"}]
sources: ["packages/design-system/src/components/ReplyCodeBlock.astro","packages/design-system/src/components/reply-scroll-area.ts","apps/portfolio-site/src/design-system/docs/reply-code-block.astro","apps/portfolio-site/src/lib/designSystemRegistry.ts"]
catalog: ["apps/portfolio-site/src/design-system/docs/reply-code-block.astro"]
previews: ["apps/portfolio-site/src/design-system/docs/reply-code-block.astro"]
---
# Reply Code Block

## Purpose
Show a standalone code sample exactly as written.

## Contract
- The only prop is `code`, a string. Render it as literal text in `<pre><code>`, preserving indentation, blank lines and line breaks. An empty string renders nothing.
- Use the shared monospace font for code, Caption size, regular weight and Body line height. Use Contrast Background and Contrast Text: black surface and white text in the default theme, white surface and black text in the inverse theme. The component has no theme prop. Use Medium Corner Radius and primitive space 4 on all sides.
- The block has no outer margin. The parent owns spacing between reply blocks. Long lines scroll horizontally inside the block and never wrap.

## Use
Chat Assistant Message renders this component for an authored `code` block. Use for a separate code or command sample. No syntax highlighting, language label or copy action.

## Do Not Use
Do not use for identifiers inside a sentence or for executable content.

## Accessibility
Only actual horizontal overflow creates a named, keyboard-focusable scroll area. Its focus and focus-visible rings use the extra-contrast Interaction States tokens for filled surfaces. The code remains readable with or without overflow.

## Verification
In the isolated preview, Short shows indented HTML as text. Long line stays on one line. On a narrow viewport, Tab into the overflowing block and scroll it with the arrow keys; widening it until it fits removes the Tab stop.

## Enabled Profile Records
- Registry ID: reply-code-block.
- Canonical route: /design-system/reply-code-block/.
