Display syntax-highlighted code snippets
import { CodeBlock } from "@plexui/ui/components/CodeBlock";
import ApiClient from "api-client";
const client = new ApiClient();
const stream = await client.completions.create({
model: "model-4.1",
messages: [{ role: "user", content: "Say 'double bubble bath' ten times fast." }],
stream: true,
});
for await (const chunk of stream) {
console.log(chunk.choices[0].delta);
}
type Props = { title: string; count: number };
const Header = ({ title, count }: Props) => (
<h1>{title} ({count})</h1>
);
type Props = { title: string; count: number };
const Header = ({ title, count }: Props) => (
<h1>{title} ({count})</h1>
);
interface User { id: number; name: string }
const createUser = (id: number, name: string): User => ({ id, name });
console.log(createUser(1, "Alice"));
interface User { id: number; name: string }
const createUser = (id: number, name: string): User => ({ id, name });
console.log(createUser(1, "Alice"));
class Person:
def __init__(self, name, age):
self.name = name
self.age = age
def greet(self):
print(f"Hi, I'm {self.name}")
import ApiClient from "api-client";
const client = new ApiClient();
const stream = await client.completions.create({
model: "model-4.1",
messages: [{ role: "user", content: "Say 'double bubble bath' ten times fast." }],
stream: true,
});
for await (const chunk of stream) {
console.log(chunk.choices[0].delta);
}
interface User { id: number; name: string }
const createUser = (id: number, name: string): User => ({ id, name });
console.log(createUser(1, "Alice"));
class Person:
def __init__(self, name, age):
self.name = name
self.age = age
def greet(self):
print(f"Hi, I'm {self.name}")
{
"user": { "id": 1, "name": "Alice" },
"roles": ["admin", "editor"],
"active": true
}
git checkout -b feature/new-feature
git add .
git commit -m "Add new feature"
docker build -t myapp:latest .
.container {
display: flex;
align-items: center;
min-height: 100vh;
}
.button:hover { cursor: pointer; }
SELECT u.id, u.name, COUNT(o.id) AS orders_count
FROM users u
JOIN orders o ON u.id = o.user_id
GROUP BY u.id, u.name;
package main
import "fmt"
func main() {
fmt.Println("Hello, world")
}
| Prop | Type | Default | Description |
|---|
children | string | — | Code content |
language | string | — | Prism language name |
className | string | — | Additional wrapper class |
| Prop | Type | Default | Description |
|---|
children | string | — | Code content |
language | string | — | Prism language name |
defaultExpanded | boolean | false | Start expanded |
collapsedHeight | number | 80 | Height when collapsed (px) |
maxExpandedHeight | number | — | Max height when expanded (px) |
copyable | boolean | true | Show copy button |