Agents
CodeBlockEditor
Editable code surface with Shiki highlighting and token-based light/dark themes.
Composition
The preferred shape for composing the installed agent from its exported parts.
Parts
Exported compound parts from the installed source.
CodeBlockEditor├── CodeBlockEditorHeader├── CodeBlockEditorTitle├── CodeBlockEditorActions├── CodeBlockEditorCopy├── CodeBlockEditorFloatingCopy├── CodeBlockEditorContent└── CodeBlockEditorTextareaThis agent installs from the chat registry. Install the bundle with the command above, or inspect the source below.
npx shadcn@latest add http://127.0.0.1:3000/r/refined/chat.jsonUsage
import { CodeBlockEditor, CodeBlockEditorActions, CodeBlockEditorContent, CodeBlockEditorCopy, CodeBlockEditorHeader, CodeBlockEditorTextarea, CodeBlockEditorTitle,} from "@/components/refined-ui/code-block-editor";import { highlightCodeToTokens } from "@/components/refined-ui/lib/code-block-shiki";export async function ServerHighlightedSnippet({ code }: { code: string }) { const tokens = await highlightCodeToTokens(code, "tsx"); return ( <CodeBlockEditor> <CodeBlockEditorHeader> <CodeBlockEditorTitle>agent-step.tsx</CodeBlockEditorTitle> <CodeBlockEditorActions> <CodeBlockEditorCopy value={code} /> </CodeBlockEditorActions> </CodeBlockEditorHeader> <CodeBlockEditorContent code={code} lang="tsx" tokens={tokens} /> </CodeBlockEditor> );}export function ClientHighlightedSnippet({ json }: { json: string }) { return ( <CodeBlockEditor> <CodeBlockEditorHeader> <CodeBlockEditorTitle>tool-result.json</CodeBlockEditorTitle> <CodeBlockEditorActions> <CodeBlockEditorCopy value={json} /> </CodeBlockEditorActions> </CodeBlockEditorHeader> <CodeBlockEditorContent code={json} lang="json" /> </CodeBlockEditor> );}export function EditableSnippet({ code }: { code: string }) { return ( <CodeBlockEditor> <CodeBlockEditorHeader> <CodeBlockEditorTitle>scratch.tsx</CodeBlockEditorTitle> </CodeBlockEditorHeader> <CodeBlockEditorTextarea defaultValue={code} fileName="scratch.tsx" /> </CodeBlockEditor> );}Installed dependencies
Installed with this agent because the visible component depends on them; they are support files, not separate product surfaces.
Shiki helper
src/registry/lib/code-block-shiki.tsHelperCopy hook
src/registry/hooks/use-copy-to-clipboard.tsHookTooltip slot
src/registry/sources/refined/ui/tooltip.tsxSkinRaw code
Primary installed agent source
Component
src/registry/sources/refined/code-block-editor.tsx
Primitives
This agent composes these library primitives, installed under components/refined-ui/ui/*.