terminal-style code window with copy button.

Live preview

setup
npx jprot init --portfolio
npm start

Install

From your site folder, run:

jprot add CodeBlock

That downloads the self-contained component into theme/components/CodeBlock.js,

where it is picked up automatically — the same way as any built-in component.

To remove it later, just delete that file.

Use it as a homepage section

Add an entry to the sections: list in jprot.config.js:

sections: [
  { component: 'CodeBlock', title: 'CodeBlock' },
]

Use it inside a page

On its own line in any Markdown file, passing the props:

:::CodeBlock code="npx jprot init --portfolio\nnpm start" lang="shell" title="setup"

Props

PropTypeNote
codestringcode text (\\n for newlines)
langstringsmall language label
titlestringwindow title ('' hides bar)

↩ Back to all elements