text.code
A block of code or terminal output shown to the reader
Text intents
Example
Pack my box with five dozen liquor jugs.
<Text intent="text.code">Pack my box with five dozen liquor jugs.</Text>Choosing between neighbours
Find the row that describes your element, and use the intent on the right.
If it is
Use
A block of code or terminal output shown to the reader
text.codethis pageA sentence that mentions code; wrap the code in <code> inside text.body
text.bodyCode or a command
rather thantext.quotetext.codethis pageA code sample on the page
rather thantext.linetext.codethis pageA code sample on the page
rather thantext.outputtext.codethis pageA code sample on the page
rather thantext.difftext.codethis pageA code sample of several lines
rather thantext.snippettext.codethis pageAn intent named in prose
rather thantext.markertext.codethis pageA code sample of several lines
rather thanlayout.commandtext.codethis page
Connections
Declared in the registry, both directions. Where an intent is used in your own code is something check and the gallery see; this site has no app code.
- Built from
For registry authors
Starter intents. These are the intents prongs add puts in your registry, shown in this site’s theme. Yours are your own registry.ts: rename, restyle and add to them, and see them with prongs add gallery.
What this intent is built from and its entry in components/prongs/registry.ts. You only need this to change how it looks or to add an intent like it.
How text.code resolves, and its definition
Each layer adds to the one before it; a later class wins over an earlier one that sets the same thing.
typography.monoMonospaced type
font-mono text-sm
tone.defaultMain text colour
text-foreground
text.codeA block of code or terminal output shown to the reader
overflow-x-auto whitespace-pre rounded-xl border border-code-border bg-surface-0 p-4 leading-[1.7]
font-mono text-sm text-foreground overflow-x-auto whitespace-pre rounded-xl border border-code-border bg-surface-0 p-4 leading-[1.7]
'text.code': {
kind: 'semantic',
description: 'A block of code or terminal output shown to the reader',
refs: ['typography.mono', 'tone.default'],
binding: {
element: 'pre',
classes: 'overflow-x-auto whitespace-pre rounded-xl border border-code-border bg-surface-0 p-4 leading-[1.7]',
},
notFor: [
{
context: 'a sentence that mentions code; wrap the code in <code> inside text.body',
instead: 'text.body',
},
],
},