Code block

Code block is a neobrutalist React component from Cruise UI. Plain-text code in the system monospace font on a dark (.on-deep) panel, with an optional file name and language label and a Copy button. Long lines scroll inside the block. Install it with npx shadcn@latest add @cruiseui/cruise-code-block.

Install

Terminal

npx shadcn@latest add @cruiseui/cruise-code-block

First time? Installation shows the one-off components.json setup (the @cruiseui registry) and how to turn the theme on.

Example

Corners
Terminal
bash
npx shadcn@latest add @cruiseui/cruise-dashboard-layout @cruiseui/cruise-stat-card
app/(dashboard)/layout.tsx
tsx
import { CruiseDashboardLayout } from "@/components/cruise/blocks/dashboard-layout";

export default function Layout({ children }: { children: React.ReactNode }) {
  return <CruiseDashboardLayout nav={nav}>{children}</CruiseDashboardLayout>;
}

When to use it

When to use

Install commands, snippets and keys in docs and settings pages.

When not to

Short inline code in a sentence (use <code>).

Props

CruiseCodeBlock

PropTypeDefaultDescription
codestring——
title?string—e.g. a file name: "app/layout.tsx".
language?string—Shown as a small label, e.g. "tsx" or "bash".
copy?booleantrueShow the Copy button.
copyLabel?string"Copy code"The Copy button's accessible name.
className?string——

Accessibility

  • The code area can take focus, so long lines scroll with the keyboard.
  • The Copy button announces "Copied".
  • No colour-only meaning: plain text, no highlighting.