Code

A value the machine wrote, shown as the machine wrote it. Code inline for a reference or a header name inside a sentence, CodeBlock for a payload or a log line.

Reach for it

A value the machine wrote: an identifier, a header, a payload.

Not for

Text a person wrote. Monospace on prose reads as a rendering fault.

Inline

Sized in em rather than from the type scale, so it follows whatever text it sits in. It is neutral on purpose: accent is the link colour and the success green is what a status carries, and a reference number is neither.

The webhook arrives with a X-Aria-Signature header. Verify it against the payload before reading invoice.reference, and reject anything that does not match with a 401.

A block, and the copy button that belongs to it

The block takes its content as a string, because that string is also what the copy button writes to the clipboard. Reading it back off the rendered children would make the copied text and the shown text two things that happen to agree. Long lines scroll by default so the indentation survives, and isWrapped turns that off for a single long value where a scrollbar would hide the half that matters.

{
    "reference": "INV-2024-0042",
    "amount": 1250.00,
    "currency": "EUR",
    "debtor": { "siren": "552100554" }
}
sha256=7d38cd7f4e2a1b0c9f6e5d4c3b2a19087f6e5d4c3b2a1908 7d38cd7f4e2a1b0c9f6e5d4c3b2a19087f6e5d4c3b2a1908

API reference

Code

Also takes the standard attributes of a element, minus className and style.

CodeBlock

PropTypeDefaultDescription
children*string-The code itself, as text. A string rather than nodes, because the block is also what the copy button writes to the clipboard. Reading that back off rendered children would mean the copied text and the shown text are two different things that happen to agree.
copyLabel*string-Names the copy button at rest, and its presence is what adds one.
copiedLabel*string-Names it during the confirmation, e.g. "Copied".
data-testidstring-Names the element for a test. Never rendered, never announced.
isWrappedbooleanfalseWraps long lines instead of scrolling them. Off by default, because a payload read in a narrow column is easier to follow when its indentation survives. On for a single long value, where a horizontal scrollbar hides the half of it that matters.