Code
Monospaced source text, inline or block.
Inline code sits within a sentence. Block code renders inside a `<pre>` so whitespace and line breaks survive, and scrolls horizontally rather than widening the page.
Import
import { Code } from "@abbainitiative/ui";Also available from the subpath entry @abbainitiative/ui/code.
This component has no state and no event handlers, so it renders inside a Server Component without a client boundary of your own.
Examples
Inline and block
Run pnpm install to begin.
const theme = "dark";<Stack gap={3}>
<Text>Run <Code>pnpm install</Code> to begin.</Text>
<Code variant="block">{`const theme = "dark";`}</Code>
</Stack>Props
| Prop | Type | Default | Description |
|---|---|---|---|
| variant | "inline" | "block" | "inline" | Inline within prose, or a standalone block. |
Accessibility
- Long block content scrolls inside its own container, so the page body never scrolls horizontally.