code-block
Code display with copy and line numbers
AIcode-block.csscode-block.js
Installation
$
npx skeehn add code-blockPreview
tsx
1
2
3
4
5
6
7
8
9
import { Button } from '@skeehn/react';
export function App() {
return (
<Button variant="dither">
Click me
</Button>
);
}Props
| Prop | Type | Default | Description |
|---|---|---|---|
| code | string | — | Code content to display |
| language | string | — | Programming language for syntax hints |
| showLineNumbers | boolean | false | Show line numbers |
| copyable | boolean | true | Show copy button |
Usage
code-block.tsx
1import { CodeBlock } from '@skeehn/react';23export function Example() {4 return (5 <CodeBlock6 code="const x = 42;"7 language="javascript"8 showLineNumbers9 copyable10 />11 );12}