DocsComponentsTemplatesThemesGitHub

CodeBlock

Monospace code panel with title and copy button.

Code

import * as React from 'react';
import { CodeBlock } from '@fruit-labs/design';

export default function Demo() {
  return (
    <CodeBlock
      title="Install"
      code={'npm install react react-dom\n# then import tokens.css and fruit.css'}
    />
  );
}

Install

From npm:

npm install @fruit-labs/design

import { CodeBlock } from '@fruit-labs/design';

Or copy the TypeScript source into your project:

npx shadcn@latest add https://design.fruitlabs.online/r/code-block.json

Guidelines

  • Use for snippets, commands and JSON. No syntax colors by default; bring your own highlighter if needed.

Props

PropTypeRequired
codestringYes
languagestringNo
titlestringNo
classNamestringNo

Edit this example on GitHub