
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
bertui-code
Advanced tools
**Zero-config syntax highlighting for React. Built exclusively for the BertUI ecosystem.**
Zero-config syntax highlighting for React. Built exclusively for the BertUI ecosystem.
The simplest way to add beautiful, functional code blocks to your BertUI applications. Dark theme by default, copy button included, zero configuration required.
⚠️ BertUI Compatibility Note: bertui-code v1.0.1 is tested with BertUI's strict transpiler. See the BertUI Compatibility section for details.
bun add bertui-code@1.0.1
# or
npm install bertui-code@1.0.1
# or
pnpm add bertui-code@1.0.1
# or
yarn add bertui-code@1.0.1
import { Code, InlineCode, CodeVariants, CodeVariant } from 'bertui-code';
// Basic code block
<Code>
const hello = "world";
console.log(hello);
</Code>
// With line numbers
<Code showLineNumbers>
function calculate(a, b) {
return a + b;
}
</Code>
// Package manager variants (NEW in v1.0.1!)
<CodeVariants>
<CodeVariant label="npm">npm install bertui-code</CodeVariant>
<CodeVariant label="pnpm">pnpm add bertui-code</CodeVariant>
<CodeVariant label="bun">bun add bertui-code</CodeVariant>
<CodeVariant label="yarn">yarn add bertui-code</CodeVariant>
</CodeVariants>
// Inline code
<p>
Use the <InlineCode>useState</InlineCode> hook for state management.
</p>
Toggle between different versions of the same code snippet with zero config:
<CodeVariants theme="dark" defaultVariant="bun">
<CodeVariant label="npm">npm run dev</CodeVariant>
<CodeVariant label="pnpm">pnpm dev</CodeVariant>
<CodeVariant label="bun">bun dev</CodeVariant>
<CodeVariant label="yarn">yarn dev</CodeVariant>
</CodeVariants>
Features:
stickyTabs={true})tabPosition="bottom")bertui-code v1.0.1 is certified for BertUI's strict transpiler. Follow these rules and it will never crash:
// ✅ GOOD - BertUI never looks inside string variables
const myCode =
'function hello(name) {\n' +
' return "Hello " + name + "!";\n' +
'}';
<Code>{myCode}</Code>
// ✅ GOOD - Even JSX/TypeScript works in strings!
const tsCode =
'interface User {\n' +
' id: string;\n' +
' name: string;\n' +
'}\n';
<Code language="typescript">{tsCode}</Code>
// ❌ BAD - BertUI WILL crash with "Expected } but found :"
<Code>
{`function hello() {
return "world";
}`}
</Code>
// ✅ GOOD - Works in BertUI
import React from 'react';
export default function Page() {
return React.createElement(Code, {
language: 'javascript',
showLineNumbers: true
}, 'const x = 1;');
}
// ✅ GOOD - Always use ={true}
<CodeVariants stickyTabs={true}>
// ❌ BAD - BertUI crashes on shorthand
<CodeVariants stickyTabs>
| Pattern | Status | Why |
|---|---|---|
const code = '...' | ✅ SAFE | Strings are opaque to BertUI |
<Code>{`code`}</Code> | ❌ CRASH | BertUI parses template literal content |
language="typescript" | ⚠️ MAY CRASH | Only safe if code is in string variable |
stickyTabs={true} | ✅ SAFE | Explicit value works |
stickyTabs | ❌ CRASH | Shorthand props not supported |
React.createElement | ✅ SAFE | No JSX transform needed |
<Code theme="dark"> // Default
<Code theme="light"> // Light mode
<Code theme="pink"> // Pink mode
<Code
colors={{
background: '#0a0a0a',
text: '#00ff00',
header: '#1a1a1a',
border: '#00ff00',
meta: '#00ff00',
button: '#00ff00'
}}
>
// Custom hacker theme
</Code>
<Code /> Component| Prop | Type | Default | Description |
|---|---|---|---|
children | string | Required | The code to display |
language | string | 'javascript' | Programming language |
theme | 'dark' | 'light' | 'pink' | 'dark' | Color theme |
colors | Object | {} | Custom color overrides |
showLineNumbers | boolean | false | Show line numbers |
showCopyButton | boolean | true | Show copy button |
className | string | '' | Additional CSS classes |
<CodeVariants /> Component (NEW)| Prop | Type | Default | Description |
|---|---|---|---|
children | CodeVariant[] | Required | Array of variants |
theme | 'dark' | 'light' | 'pink' | 'dark' | Color theme |
defaultVariant | number | string | 0 | Default tab by index or label |
stickyTabs | boolean | false | Make tabs sticky on scroll |
tabPosition | 'top' | 'bottom' | 'top' | Tab bar position |
showCopyButton | boolean | true | Show copy button |
colors | Object | {} | Custom colors for code |
tabColors | Object | {} | Custom colors for tabs |
<CodeVariant /> Component (NEW)| Prop | Type | Default | Description |
|---|---|---|---|
children | string | Required | The code for this variant |
label | string | Required | Tab label (npm, pnpm, etc) |
language | string | 'javascript' | Language for this variant |
showLineNumbers | boolean | false | Show line numbers |
<InlineCode /> Component| Prop | Type | Default | Description |
|---|---|---|---|
children | string | Required | The inline code |
theme | 'dark' | 'light' | 'pink' | 'dark' | Color theme |
// code-examples.js
export const npmExample = 'npm install bertui-code';
export const jsExample =
'function add(a, b) {\n' +
' return a + b;\n' +
'}';
// page.jsx
import { jsExample } from './code-examples.js';
<Code>{jsExample}</Code>
const longCode =
'import React from "react";\n' +
'\n' +
'export function Button({ children }) {\n' +
' return (\n' +
' <button className="btn">\n' +
' {children}\n' +
' </button>\n' +
' );\n' +
'}\n';
// ✅ GOOD - In a .ts file
export const tsCode = 'const name: string = "John";';
// ❌ BAD - In a .jsx file
const tsCode = 'const name: string = "John";'; // BertUI may crash!
// test-page.jsx - Create a test page to verify BertUI compatibility
import { Code } from 'bertui-code';
const testCode = 'console.log("Hello BertUI!");';
export default function TestPage() {
return React.createElement(Code, {}, testCode);
}
<CodeVariants theme="dark" defaultVariant="bun">
<CodeVariant label="npm">npm install bertui-code</CodeVariant>
<CodeVariant label="pnpm">pnpm add bertui-code</CodeVariant>
<CodeVariant label="bun">bun add bertui-code</CodeVariant>
<CodeVariant label="yarn">yarn add bertui-code</CodeVariant>
</CodeVariants>
<CodeVariants theme="light">
<CodeVariant label="JavaScript" language="javascript">
{javascriptExample}
</CodeVariant>
<CodeVariant label="TypeScript" language="typescript">
{typescriptExample}
</CodeVariant>
<CodeVariant label="Python" language="python">
{pythonExample}
</CodeVariant>
</CodeVariants>
<CodeVariants theme="dark" tabPosition="bottom" stickyTabs={true}>
<CodeVariant label="cURL" language="bash">{curlExample}</CodeVariant>
<CodeVariant label="fetch" language="javascript">{fetchExample}</CodeVariant>
<CodeVariant label="axios" language="javascript">{axiosExample}</CodeVariant>
</CodeVariants>
Expected "}" but found ":"Cause: TypeScript syntax in .jsx file or template literal in JSX
Fix: Move code to string variable outside component
Cause: BertUI doesn't support React 18 automatic JSX runtime
Fix: Use React.createElement or add /** @jsx React.createElement */
Cause: BertUI doesn't support {stickyTabs} shorthand
Fix: Always use stickyTabs={true}
bertui-code/
├── src/
│ ├── Code.js # Main code block component
│ ├── CodeVariants.js # Multi-variant tabs (NEW)
│ ├── CodeVariant.js # Individual variant (NEW)
│ ├── CopyButton.js # Copy button component
│ ├── InlineCode.js # Inline code component
│ ├── ThemeProvider.js # Theme context (optional)
│ └── index.js # Main exports
├── dist/ # Built files
├── package.json # v1.0.1
└── README.md # You are here
MIT © Pease Ernest
Part of the BertUI ecosystem
Built with ❤️ for developers who value simplicity and speed
GitHub • npm • BertUI Compatibility
v1.0.1 • Zero-config • BertUI-certified
FAQs
**Zero-config syntax highlighting for React. Built exclusively for the BertUI ecosystem.**
We found that bertui-code demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.