Code Block

A component for displaying formatted code with syntax highlighting.

Installation

Import the component from the passport-ui package.

components/example.tsx
1
import { CodeBlock } from "passport-ui";

Usage

Basic example showing how to use the component.

components/example.tsx
1
2
3
4
5
const sampleCode = `function greet(name) {
console.log(`Hello, ${name}!`);
}`;
<CodeBlock code={sampleCode} language="javascript" />;

Additional resources

Documentation and examples are available in Storybook.