Skip to content

Code

Code renders code in both block and inline modes. Block mode includes an optional language label and a copy-to-clipboard button.

Block

Tailwind v4
vue
<Code>const greeting = 'Hello, world!'
console.log(greeting)</Code>

With language label

Tailwind v4
vue
<Code language="vue">
&lt;template&gt;
  &lt;Button variant="primary"&gt;Click me&lt;/Button&gt;
&lt;/template&gt;
</Code>

Without copy button

Tailwind v4
vue
<Code language="bash" :show-copy="false">npm install @jetpacklabs/ui</Code>

Inline

Use inline for code references within body text.

Pass the prop to bind the component.

Tailwind v4
vue
<p>Pass the <Code inline>modelValue</Code> prop to bind the component.</p>

Copy button behavior

Clicking Copy calls navigator.clipboard.writeText() with the text content of the slot. The button label changes to Copied! for 2 seconds, then resets.

Props

PropTypeDefaultDescription
inlinebooleanfalseRenders as an inline <code> span
languagestringLanguage label shown in the header bar (display only, no syntax highlighting)
showCopybooleantrue (block) / false (inline)Show copy-to-clipboard button

Private — Jetpack Labs internal use only