Skip to Content
ComponentsCode

Code

Monospace text for inline code references. Renders as a <code> tag by default.

Use npm install to install dependencies.

Import with import { Code } from ”@/components/ui/code”

import { Code } from "@/components/ui/code"
<p>Run <Code>npm install</Code> to get started.</p>

Examples

Default vs Compact

Default (16px)

The useState hook manages local state.

Compact (12.44px)

Pass asChild to override the rendered tag.

<Code>useState</Code> <Code size="compact">asChild</Code>

Custom element with asChild

Cmd+K
<Code asChild> <kbd>Cmd+K</kbd> </Code>
Last updated on