Code Block
A content-aware code container with syntax highlighting and copy functionality.
function greet(name: string) {
return `Hello, ${name}!`;
}
console.log(greet('Raya'));With Filename
Adding a file-name prop automatically creates a header bar.
Terminal
npx shadcn-vue@latest add https://raya-ui.com/registry/code-block.jsonWith Animated Tabs
You can place AnimatedTabs directly inside the #header slot.
npm install raya-uiProps
| Prop | Type | Description |
|---|---|---|
| code | string | The raw code string to highlight. |
| lang | string | Language for syntax highlighting (default: 'typescript'). |
| fileName | string | Optional text to display in a header bar (if no header slot). |
Slots
| Slot | Description |
|---|---|
| #header | Custom content for the header bar (e.g., AnimatedTabs). Overrides fileName. |