---
title: Code
description: A block of code or config text with a copy button.
---

<Component path="code/variants" />

## Variants

- Default: a snippet or a config block on its own, for example an API key or a request body. Long lines wrap.
- `ghost`: the same block without the frame, inside a surface that already has one.
- `compact`: a short value in a step or a settings row, for example an environment variable. One line is 32px high. Each line of the value keeps its own row, and the copy button stays centered. A long line scrolls horizontally and does not wrap. Pass `copyValue` and `copyLabel`, and the block renders a small ghost copy button.

## Copy button

Pass one of these, or neither for a block with no copy button:

- `copyValue` and `copyLabel`: the text to copy and the button's name for screen readers and its tooltip. The button matches the variant. Both are required together.
- `copyButton`: a custom button, for a value that differs from the shown text or a button with its own behavior. It cannot be combined with `copyValue`.
