Import
import { Code, Pre } from "@sugarcoat/ui-nxt";Usage
<Code>const x = 42;</Code>
<Pre>
function hello() {
console.log("Hello!");
}
</Pre>Inline Code#
Use the Code component for inline code snippets within text.
Inline Code
Code Colors#
Apply different color schemes to inline code.
Default
Primary
Accent
Success
Warning
Error
Transparent
All Colors Together#
Color Comparison
Code Block (Pre)#
Use the Pre component for multi-line code blocks.
Code Block
In Context#
Using code components within documentation-style content.
Documentation Style
Semantic Usage#
Use different colors to convey meaning in documentation.
Semantic Colors
Props#
Code#
| Prop | Type | Default | Description |
|---|---|---|---|
| color | "default" | "primary" | "accent" | "success" | "warning" | "error" | "transparent" | "default" | Color scheme for the code |
| children | ReactNode | - | Code content to display |
Pre#
| Prop | Type | Default | Description |
|---|---|---|---|
| children | ReactNode | - | Code block content |
Styling Details#
| Component | Font | Background | Border Radius |
|---|---|---|---|
Code | Monospace | Subtle background | Small |
Pre | Monospace | Subtle background | Medium |