Tuimorphic

Code

Inline code and keyboard shortcut display with terminal styling.

Import

import { Code } from 'tuimorphic';

Usage

The Code component displays inline code snippets and keyboard shortcuts. For multi-line code, use the CodeBlock component.

Run npm install tuimorphic to install.

<Code>const x = 42</Code>

Props

PropTypeDefaultDescription
variant'default' | 'subtle' | 'accent''default'Visual variant
kbdbooleanfalseRender as keyboard shortcut styling
childrenReact.ReactNode-Code content
classNamestring-Additional CSS class names

Variants

Default

The useState hook returns a stateful value and a function to update it.

<Code>const x = 42</Code>

Subtle

Default: const x = 42

Subtle: config.json

Accent: npm run build

<Code variant="subtle">npm install</Code>

Accent

<Code variant="accent">npm install tuimorphic</Code>

Keyboard Shortcut

Use the kbd prop for keyboard shortcut styling:

Press Ctrl + C to copy, Ctrl + V to paste.

<Code kbd>Ctrl+C</Code>
<Code kbd>Cmd+V</Code>
<Code kbd>Alt+Tab</Code>

Inline with Text

<p>
  Run <Code>npm install</Code> to install dependencies,
  then press <Code kbd>Ctrl+C</Code> to stop the server.
</p>

On this page