Code Block
A styled code display container with copy-to-clipboard, language badge, and line numbers.
Default
Code block with language badge and copy button.
julia
using Suite
Button(variant="outline", "Click me")Line Numbers
Display line numbers alongside code.
julia
1
2
3
4
5
function hello(name)
println("Hello, $name!")
end
hello("World")No Copy Button
Code display without copy functionality.
bash
npm install therapyMinimal
Plain code block without header.
x = 42Usage
julia
using Suite
# With language badge
CodeBlock("println(\"Hello\")", language="julia")
# With line numbers
CodeBlock(code, language="julia", show_line_numbers=true)
# Without copy button
CodeBlock("simple", show_copy=false)API Reference
| Prop | Type | Default | Description |
|---|---|---|---|
| code | String | "" | The code text to display |
| language | String | "" | Language name shown as badge (e.g., "julia", "bash") |
| show_line_numbers | Bool | false | Whether to display line numbers |
| show_copy | Bool | true | Whether to show copy-to-clipboard button |
| class | String | "" | Additional CSS classes |
| theme | Symbol | :default | Theme preset |