laif-ds
Version:
Design System di Laif con componenti React basati su principi di Atomic Design
32 lines (22 loc) • 620 B
Markdown
# CodeHighlighter
## Overview
Client-side code highlighter using Shiki with internal loading state and graceful fallback.
## Props
| Prop | Type | Description |
| --- | --- | --- |
| `children` | `string` | Code string |
| `language` | `string` | Shiki language key |
| `className` | `string` | Optional classes for `<pre>` |
## Example
```tsx
import CodeHighlighter from "laif-ds/CodeHighlighter";
export function CodeExample() {
return (
<CodeHighlighter language="tsx" className="rounded-md border p-3 text-sm">
{`export const x = (n: number) => n * 2`}
</CodeHighlighter>
);
}
```