Codeblock

Documentation and examples for the Codeblock component.

Preview

code
This is a piece of copyable code. Anything can be written here.
Click on the copy button on the top right corner of the box

Properties

PropTypeDefaultDescription
languagestring"code"Displays the language name on the top bar.
classNamestringdefault lookVisual overrides for the container.
windowedbooleantrueDisplays the window-style dots on the top left.

Usage

Follow these steps to add and use Code Block.

1

Create next app (skip if you already have setup a next app)

terminal
npx create-next-app@latest --yes
2

Install

terminal
npx modui-uikit@latest add codeblock
3

Implement

typescript
import { Codeblock } from '@/components/ui/codeblock'
  
  export default function Example() {
    return (
      <Codeblock language="C#">
        This is some random piece of code. It can copied
      </Codeblock>
    )
  }