Skip to content
Entangle UI v0.13.0

Code

A small inline <code> primitive that picks up the theme monospace font and the colors.background.inset token so inline snippets read as recessed surfaces inside body text. For multi-line or syntax-highlighted blocks use ChatCodeBlock (under the editor namespace).

Live Preview

import { Code } from 'entangle-ui';
<Text>
Run <Code>npm install entangle-ui</Code> to add the package.
</Text>

The font size is relative to the surrounding text — use size to fine-tune the scale.

Sizes

<Code size="xs">xs</Code> {/* 0.8em */}
<Code size="sm">sm</Code> {/* 0.9em — default */}
<Code size="md">md</Code> {/* 1em */}

Code is inline — it sits on the same baseline as surrounding text and wraps naturally.

Inside a sentence

<Text>
Install with <Code>npm install entangle-ui</Code> and import from the root
barrel: <Code>{"import { Button } from 'entangle-ui'"}</Code>.
</Text>

Inherits text color from its parent, so it plays nicely with colored anchors.

Inside a link

<a href="/components/primitives/button">
See the <Code>Button</Code> docs
</a>

With string literals

<Text>
The environment variable <Code>NODE_ENV</Code> defaults to{' '}
<Code>"development"</Code> when running <Code>npm run dev</Code>.
</Text>
Prop Type Default Description
children ReactNode Inline code content.
size 'xs' | 'sm' | 'md' 'sm' Font size scale, relative to surrounding text.
className string Additional CSS class names.
style CSSProperties Inline styles.
testId string Test identifier for automated testing.
ref Ref<HTMLElement> Ref to the underlying code element.

| Token | Used for | | ---------------------------- | ---------------------- | | colors.background.inset | Sunken background fill | | colors.text.primary | Foreground text | | typography.fontFamily.mono | Monospace family | | borderRadius.sm | Corner radius (2px) |

  • Renders a semantic <code> element so assistive tech announces it as inline code
  • No interactive behavior — wrap with a link or button if needed