/
1.1k
Sponsor

Code

Syntax-highlighted code block (50+ languages)

Terminal

Installation

$ pnpm dlx shadcn@latest add @termcn/ink/code

Usage

import { Code } from "@/components/ui/code";
<Code language="typescript">
  {`const greeting = "Hello, world!";\nconsole.log(greeting);`}
</Code>

Examples

Multiline

Terminal

API Reference

Code

PropTypeDefault
childrenstringrequired
languagestring-
inlinebooleanfalse
borderStyle"single" | "double" | "round" | "bold" | "singleDouble" | "doubleSingle" | "classic""single"
showLineNumbersbooleantrue
lineNumberSeparatorstring"│ "
keywordColorstring-
stringColorstring-
numberColorstring-
commentColorstring-
operatorColorstring-
plainColorstring-

Notes

Accessibility

termcn exposes the following behavior through Ink's terminal accessibility APIs. This is not a browser ARIA or general WCAG-conformance claim.

  • Screen reader: Screen-reader mode removes decorative output while preserving meaningful labels and state.