Inline code
Mono at 0.9em on a quiet fill. Commands and ids can copy on click.
On this page
Code in prose, and a command that copies on click.
Installation
Usage
import { InlineCode } from "@/components/ui/chatcn/inline-code"
<InlineCode>getSession()</InlineCode>
<InlineCode copyable>pnpm add @auth/core</InlineCode>Props
| Prop | Type | Notes |
|---|---|---|
copyable | boolean | Turns the code into a copy button with a tooltip |
copyValue | string | Text to copy. Defaults to the rendered text |
onCopy | (value) => void | Called 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.