ComponentsCode Block
Code Block
NewDisplays source code with optional syntax highlighting, filename, line numbers, and copying.
Installation
bunx @swift-rust/ui add code-block
Usage
tsx
1import { CodeBlock } from "@/components/ui/code-block";23<CodeBlock4filename="button.tsx"5language="tsx"6code={'<Button>Save</Button>'}7/>
Examples
cta.tsx
1import { Button } from "@/components/ui/button";23export function Cta() {4return <Button design="3d">Get started</Button>;5}