# Code block usage guidelines

> Discover Cimpress UI's code block component.

Source: https://ui.cimpress.io/components/code-block/

Code block displays preformatted code or command snippets in a dedicated container with overflow scrolling when needed.

### When to use

- To show multi-line code examples in documentation.
- To display terminal commands, configuration snippets, or JSON payloads.
- To preserve exact whitespace and line breaks in technical content.

### When not to use

- For inline code formatting; use [code](/components/code) instead.
- For rich text content that does not require preserved whitespace.

## Usage

```tsx
import { CodeBlock } from '@cimpress-ui/react';

export default function Demo() {
  return (
    <CodeBlock
      code={`{
  "name": "John Doe",
  "age": 30,
  "email": "john.doe@example.com"
}`}
    />
  );
}
```
