Components
Code
Renders inline or block code with monospace styling.
Overview
Code renders inline <code> or block <pre><code> elements with monospace styling for displaying code snippets, terminal commands, and variable names.
Inline Code
Install with npm install @ds0/tokens to get started.
Code Block
import { Button } from '@ds0/react';
import { tokens } from '@ds0/tokens';
Usage
<p>Run <Code>npm install @ds0/primitives</Code> to get started.</p>
<Code variant="block">{'const x = 1;\nconsole.log(x);'}</Code>API Reference
| Prop | Type | Default | Description |
|---|---|---|---|
variant | 'inline' | 'block' | 'inline' | Inline or block code |
className | string | — | Additional CSS classes |
Related Components
| Component | When to Use Instead |
|---|---|
| Text | For regular text content |