Code Block

A component for displaying formatted code with syntax highlighting.

Installation

Import the component from the passport-ui package.

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

Usage

Basic example showing how to use the component.

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

Additional resources

Documentation and examples are available in Storybook.