Code
Inline code and keyboard shortcut display with terminal styling.
Import
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.
Props
| Prop | Type | Default | Description |
|---|---|---|---|
| variant | 'default' | 'subtle' | 'accent' | 'default' | Visual variant |
| kbd | boolean | false | Render as keyboard shortcut styling |
| children | React.ReactNode | - | Code content |
| className | string | - | Additional CSS class names |
Variants
Default
The useState hook returns a stateful value and a function to update it.
Subtle
Default: const x = 42
Subtle: config.json
Accent: npm run build
Accent
Keyboard Shortcut
Use the kbd prop for keyboard shortcut styling:
Press Ctrl + C to copy, Ctrl + V to paste.