⚠️ Design system CSS not found. Check the path in cms/docs.config.js → designSystemPath, then re-run npm run docgen.

Code

Inline code, code blocks, and keyboard shortcuts

Design System / Code
Download .md file
Open .md in new tab

The design system styles three code-related elements: inline code, block-level pre, and keyboard shortcuts kbd. All use the mono font ().


Inline code

Use for the main text colour.

<p>Use <code>var(--text-primary)</code> for the main text colour.</p>

Inline code gets a subtle background, small padding, and rounded corners. It uses word-break: break-word to wrap within narrow containers.


Code blocks

.card {
  background-color: var(--background-primary);
  color: var(--text-primary);
  border-radius: var(--radius-m);
}
<pre><code>.card {
  background-color: var(--background-primary);
  color: var(--text-primary);
}</code></pre>

Code blocks use pre with a nested code element. The inner code resets inline code styles (background, padding, border-radius) so they don't stack.


Keyboard shortcuts

⌘ + K
<kbd>⌘</kbd> + <kbd>K</kbd>

The kbd element renders with a subtle 3D key appearance using border and box-shadow.


Combining kbd elements

Press Ctrl + Shift + P to open the command palette.

<p>Press <kbd>Ctrl</kbd> + <kbd>Shift</kbd> + <kbd>P</kbd> to open the command palette.</p>

Accessibility

  • code and pre elements are announced by screen readers as code
  • kbd is announced as "keyboard input" by most screen readers
  • Ensure code blocks have sufficient colour contrast in both light and dark modes

Usage rules

Do:

  • Use code for inline references to variables, functions, filenames
  • Use pre > code for multi-line code examples
  • Use kbd for keyboard shortcuts and key references

Don't:

  • Don't use code for emphasis — use strong or em instead
  • Don't use pre without a nested code element

CSS reference

This section documents how the component is built. For usage, see the sections above.

Inline code

Property Value
Font family
Font size calc(var(--body-size) - .2em)
Background color-mix(in srgb, var(--text-primary), var(--alpha-5))
Padding var(--space-2xs) var(--space-xs)
Border radius
Color
White space nowrap

Code blocks (pre)

Property Value
Background
Border var(--border-s) solid var(--border-faded)
Padding
Overflow overflow-x: auto
Font family
Font size calc(var(--body-size) - 2px)
Line height

pre code resets the inline code background, padding, and border-radius to prevent stacking.

Keyboard shortcut (kbd)

Property Value
Display inline-block
Padding var(--space-xs) var(--space-s)
Font family
Font size
Line height
Color
Background
Border var(--border-s) solid var(--border-secondary)
Border radius
Box shadow 0 1px 0 var(--border-secondary)

Selectors

Selector Purpose
code Inline code styling
pre Code block container
pre code Resets inline code styles inside blocks
kbd Keyboard shortcut key appearance
On this page
  • Inline code
  • Code blocks
  • Keyboard shortcuts
  • Combining kbd elements
  • Accessibility
  • Usage rules
  • CSS reference
Previous

Table

Next

Mark, Abbr & Figure

Was this page helpful?

We use this feedback to improve our documentation.

Thanks for your feedback

Send feedback

© 2026 By Default