This page as markdown: /code.md · Index for agents: /llms.txt · Everything in one file: /llms-full.txt

Code

Status: stable

Inline code. A styled <code> for code spans, keys, and identifiers inside running text — soft muted fill, monospace.

Keywords: code, inline code, token, monospace

Usage

Use Code for short inline identifiers, commands, tokens, props, and file names inside prose.

Best practices

Props

Name Type Default Description
...props ComponentPropsWithRef<"code"> — All native <code> attributes (children, className, ref, …) pass through.

Tokens used

muted, foreground

Accessibility

Related

Examples

Inline

import { Code } from "@sableui/react"

Run <Code>pnpm dev</Code> to start the server.

Code vs CodeBlock

import { Code, CodeBlock } from "@sableui/react"

// Picking the wrong one is the usual mistake:
//
//   Code                   inline, inside a sentence       → `useState`
//   CodeBlock              multi-line, read-only           → an example to study
//   CodeBlock prompt="
quot; one line, meant to be COPIED → an install command Install with <Code>pnpm add @sableui/react</Code> {/* ✗ they will want to copy it */} <CodeBlock prompt="
quot; code="pnpm add @sableui/react" /> {/* ✓ one line, with a copy button */}