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'content_copyCopy
Example with JSON data
content_copyCopy
live example
Example with Code snippet
The indentation of the code snippet is the same as passed in the code prop.
content_copyCopy
live example
Will work the same if passed with children
.