ReferenceComponents

code

Code, a command or log lines, monospaced, with a copy button.

For developer tools. code shows a snippet, a command or a few log lines in a monospaced face on a dark plate, with its language and a copy button.

bashCopy
curl -H 'X-Rendel-Key: rd_pk_test_…' \
  https://api.rendel.ai/health

Drawn live in your browser with the SDK’s own sizes and colours, not a screenshot.

Rendered natively by the Flutter SDK since 0.44.0 and the web SDK since 0.21.0. A build that does not declare it is never offered it.

When not to use it

For anything a person would read as prose, or for a value to copy — an account number, a booking reference — which is a key_value row with copy.

Props

Every block also carries type and a required fallback_text of 1 to 300 characters.

PropTypeRequiredConstraints
languagestringNoUp to 24 characters.
codestringYes1 to 4000 characters.
captionstringNoUp to 120 characters.

On the wire

{
  "id": "blk_81",
  "type": "code",
  "fallback_text": "A curl command that checks the API is up.",
  "props": {
    "language": "bash",
    "code": "curl -H 'X-Rendel-Key: rd_pk_test_…' \\\n  https://api.rendel.ai/health",
    "caption": "Returns 200 when the API is up."
  }
}

Interaction

Copy puts the whole of code on the clipboard and says Copied. A long line scrolls sideways inside the block; the page never does. caption sits under the plate.