Skip to content
ContentInline codeMenu

Inline code

Mono at 0.9em on a quiet fill. Commands and ids can copy on click.

Code in prose, and a command that copies on click.

Installation

$ pnpm dlx shadcn@latest add https://chatcn.dev/r/inline-code.json

Usage

tsx
import { InlineCode } from "@/components/ui/chatcn/inline-code"

<InlineCode>getSession()</InlineCode>
<InlineCode copyable>pnpm add @auth/core</InlineCode>

Props

PropTypeNotes
copyablebooleanTurns the code into a copy button with a tooltip
copyValuestringText to copy. Defaults to the rendered text
onCopy(value) => voidCalled after a copy

Accessibility

  • Copyable code is a real button; the result is announced as Copied.
  • Long identifiers break anywhere instead of overflowing the line.