DS0
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

PropTypeDefaultDescription
variant'inline' | 'block''inline'Inline or block code
classNamestringAdditional CSS classes
ComponentWhen to Use Instead
TextFor regular text content

On this page