Chat Code Block
Fenced code surface for chat replies, pinned dark in both modes, with a language label and copy button. Lazy-loads Shiki for highlighting and waits until a streamed fence closes.
The source comes with full access.
One payment of $149 opens the source right here and lets the CLI install every paid component, with lifetime updates.
Installation
pnpm dlx shadcn add @01orbital/chat-code-blocknpx shadcn add @01orbital/chat-code-blockyarn shadcn add @01orbital/chat-code-blockbunx --bun shadcn add @01orbital/chat-code-blockPart of the 01orbital library. With a license, put ORBITAL_TOKEN in .env.local and the same command installs it (licensed install, pricing).
It lands at components/chat/chat-code-block.tsx, as source you own and edit.
Usage
import { ChatCodeBlock } from "@/components/chat/chat-code-block"
const CODE = `import { useChatStream } from "@/hooks/use-chat-stream"
const { turns, send, stop, streaming } = useChatStream({
endpoint: "/api/ai/chat",
system: "Answer in two plain sentences.",
})`
export default function ChatCodeBlockDemo() {
return (
<div className="grid w-full max-w-2xl place-items-center p-6">
{/* Full width: centred alone, the figure would size to its longest
line and spill past a phone instead of scrolling inside. */}
<ChatCodeBlock code={CODE} lang="tsx" className="w-full" />
</div>
)
}API reference
Prop
Type
Dependencies
npm: @phosphor-icons/react, cn, shiki. The CLI installs them for you.
Registry pieces it installs with it:
- button
font-geist-monouse-copy-to-clipboard
More Chat
Compare
Every Chat component side by side, with a picture and description of each. Open one for its preview, API and install.
Chat Composer
Chat message form with an auto-growing textarea that stops at a fixed height and scrolls, and a send button that turns into stop while a reply streams. Enter sends, Shift+Enter adds a line.