Cloud|

@k2b/ui

Code

Selectable source with language-aware highlighting and copy.

CodeDisplay@k2b/ui

Selectable source with quiet chrome, optional titles, copy, and exact language modes.

Install

Copy
1bun add @k2b/ui
2bun run build

component.tsx

Copy
1export const Status = () => <span data-ready="true">Ready</span>;

TSX

Copy
<CodeDisplay title="Install" language="script" code="bun add @k2b/ui" />
<CodeDisplay title="component.tsx" language="tsx" code={componentSource} />

CodeDisplay renders highlighted, selectable source with optional title, line numbers, and copy action. The application owns the source text and its trust boundary.

Use code

Use it for read-only snippets, generated configuration, and diagnostic payloads. Use StructuredDataPreview for data whose structure matters more than its serialized form.

Import

tsx
import {
  CodeDisplay,
  type CodeDisplayLanguage,
  type CodeDisplayProps,
} from "@k2b/ui";

CodeDisplayLanguage supports TypeScript, JavaScript, script, Markdown, and plain text modes. Line numbers and copy are enabled by default and can be disabled independently.

Accessibility

Source remains selectable text. Titles and copy controls have text labels. Highlighting must not be the only explanation of an important token.

Runtime

Highlighting renders on the server. Copy requires hydration and the Clipboard API.

Example

tsx
<CodeDisplay
  title="health.ts"
  language="ts"
  code={`export const health = () => ({ ok: true });`}
/>

Connect a coding agent

The Cloud skill provides compact working instructions. MCP supplies exact current documentation when details matter.

CLI command
bunx skills add https://docs.example.com

This command installs the working instructions published by this website in the selected coding agent.

For exact, current details, also connect the MCP server through one of the agent tabs.

Installation uses the open-source Vercel Skills CLI.

The skill and MCP complement each other: the skill describes workflows, while MCP supplies current documentation.