Castle logo

CASTLE UI

Search

K

Usage

The CodeBlock component is used to present JSON data or Code snippets in a formatted and readable manner. It allows you to pass in JSON data with json prop, or Code snippet as code prop, which will be displayed with syntax highlighting and proper indentation for better readability.

Import

import { CodeBlock } from '@passfort/castle'

Copy

Example with JSON data

Copy

live example

Example with Code snippet

The indentation of the code snippet is the same as passed in the code prop.

Copy

live example

Will work the same if passed with children.

Contents