prongs
GitHub

text.code

A block of code or terminal output shown to the reader

Component

Renders

<pre>

Profile

Comes from

starter
Read https://www.prongs.dev/docs/intents/text/code.md and tell me whether text.code fits what I am building.

Example

Preview
npx prongs add saas
<Text intent="text.code">npx prongs add saas</Text>

Connections

Choosing between neighbours

  • If it is

    Use

  • A block of code or terminal output shown to the reader

    text.code
  • A sentence that mentions code; wrap the code in <code> inside text.body

    text.body
  • Code or a command

    rather than text.quote
    text.code

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.mono

    Monospaced type

    font-mono text-sm leading-6
  • tone.default

    Main text colour

    text-foreground
  • surface.sunken

    Recess cut into what it sits in

    surface-inset rounded-lg
  • text.code

    A block of code or terminal output shown to the reader

    overflow-x-auto whitespace-pre p-4
Final classes
font-mono text-sm leading-6 text-foreground surface-inset
rounded-lg overflow-x-auto whitespace-pre p-4
Definition
TS
'text.code': {
kind: 'semantic',
description: 'A block of code or terminal output shown to the reader',
refs: ['typography.mono', 'tone.default', 'surface.sunken'],
binding: { element: 'pre', classes: 'overflow-x-auto whitespace-pre p-4' },
notFor: [
{
context: 'a sentence that mentions code; wrap the code in <code> inside text.body',
instead: 'text.body',
},
],
},