@cline/ui
v0.2.2
Published
Shared Cline web theme and reusable agent UI components
Readme
@cline/ui
Shared visual foundations and reusable React presentation primitives for Cline web products. The package lets teams adopt the same semantic theme and agent chat language without adopting another product's routes, state, or runtime.
The package is published to npm with the SDK packages and shares their version. Its API is still pre-stable, so consumers should pin an exact version and review compatibility notes when updating.
See the adoption primer for complete setup instructions, component examples, boundaries, and release status.
Install
bun add --exact @cline/uiUse @cline/ui@nightly only for deliberate previews. Monorepo consumers use
"@cline/ui": "workspace:*" instead.
Entry points
| Import | Contents | Runtime requirement |
| --- | --- | --- |
| @cline/ui | Reusable React primitives exported from components/index.ts | React 18.3 or 19 and Tailwind v4 |
| @cline/ui/components.css | Styles, namespaced Tailwind mappings, and source registration for the root React primitives | Tailwind v4 and theme tokens |
| @cline/ui/theme/palette.css | Cline-owned light/dark solid and alpha color scales | CSS |
| @cline/ui/theme/tokens.css | Light/dark custom properties only | CSS |
| @cline/ui/theme/scoped-tokens.css | Light/dark custom properties scoped to .cline-ui-theme | CSS |
| @cline/ui/theme/theme.css | Tailwind v4 semantic mapping and dark variant | Tailwind v4 |
| @cline/ui/components/markdown.css | Optional framework-neutral Markdown and Streamdown treatment | Theme tokens |
| @cline/ui/theme/base.css | Optional document, Markdown, scrollbar, selection, and cursor styles | Tailwind v4 |
| @cline/ui/theme/index.css | Complete theme: tokens, Tailwind mapping, and base styles | Tailwind v4 |
| @cline/ui/components/agent-chat | Conversation, message, reasoning, action, and tool-activity React primitives | React 18.3 or 19 |
| @cline/ui/components/agent-chat.css | Framework-neutral styles for the agent-chat primitives | Theme tokens |
| @cline/ui/components/message-scroller | Shadcn message scrolling, turn anchors, visibility hooks, and centered scroll controls | React 19 |
| @cline/ui/components/message-scroller.css | Framework-neutral scroller styles (also included in components.css) | Theme tokens |
@shadcn/react is pinned to 0.3.1 with a Bun dependency patch in
patches/@shadcn%[email protected]. The patch consumes anchors from loaded
and prepended history and distinguishes existing rows from replacement DOM
nodes, so prompt acknowledgment and typing-indicator replacement preserve the
reader's position. Keep the patch when upgrading until upstream passes
tests/message-scroller.test.tsx. Consumers installing outside this monorepo
must apply the same patch until an upstream release includes the fix.
MessageScroller composes @shadcn/react/message-scroller. It provides turn
anchoring, streaming follow behavior, message jumps, and visibility tracking.
The dedicated entry point requires React 19; see the
message scroller guide for composition and
transcript outline examples.
SessionStatus uses semantic tone colors by default. Set
--cline-ui-session-status-color on the component to override its dot color
for a host-specific status palette.
The package also provides SectionHeading, DetailList/DetailListItem,
ItemCard, EmptyState, Banner, Dialog, and AlertDialog. See the
shared page component guide for composition
and action handling. Dialogs also require React DOM and support scoped themes
through portalContainer. Hosts retain data, navigation, persistence, and action state.
SearchCombobox provides a searchable selector for repository and model lists.
Its in-place panel requires ancestors that do not clip overflow.
Import components.css after Tailwind and either token entry point. It
registers package-namespaced mappings and the packaged component sources so
their utilities are emitted without changing generic host utility names.
AgentQuickActions renders prompt shortcuts and reports selection to the host.
AgentConversationLayout, AgentConversationHeader, and AgentSessionContent
share welcome/conversation geometry and header groups through host-owned slots.
See the conversation layout adoption guide.
Button and IconButton share primary, secondary, and ghost variants
across accent, neutral, and destructive tones. Existing fill and surface
variants remain aliases for primary and secondary. Without asChild, both
default to type="button". Composed children retain their native form behavior
unless a type is specified; a native button without a type submits its form.
IconButton requires an accessible aria-label, and both components support
Radix-style composition through asChild.
Both support controlled loading with a reduced-motion-aware spinner and
aria-busy; disabled remains explicit so loading actions can still offer
cancellation. Button accepts loadingLabel, and both accept a custom
loadingIcon and iconTone="inherit" | "muted" for managed icons.
Both controls share heights and corner radii per size: xs/sm use
--radius-md, and md/lg use --radius-lg. At default spacing their heights
are 1.75rem, 2rem, 2.25rem, and 2.5rem respectively; icon buttons are square.
See the button sizing table.
import { Button, IconButton } from "@cline/ui";
<Button size="sm" tone="accent" variant="primary">
Continue
</Button>;
<IconButton aria-label="Close" size="sm">
<CloseIcon />
</IconButton>;Icon props are optional; existing child icons keep working. Badge renders a
span by default and a native button when interactive is supplied. See the
control adoption examples for icon props, press
feedback, and badge variants.
AgentAurora fills its nearest positioned ancestor, which must have resolved
dimensions.
Switch is a native checkbox styled as a switch, with sm and md sizes
(default: md). It supports
checked, defaultChecked, onCheckedChange, and native input/form props.
Provide an accessible name with a label or aria-label. Its ref targets the
input; className and style customize the wrapper. See switch usage and
implementation rationale for examples and design decisions.
Use pending to temporarily lock a switch while retaining its checked-state
appearance; explicit disabled keeps the unavailable appearance.
AgentHeroHeading renders the shared cycling “What would you like to …?”
welcome heading and respects reduced-motion preferences.
AgentWelcomeHero renders the interactive Cline bot and grid used on agent
welcome surfaces. It supports bot-only and grid-only compositions and becomes
static when reduced motion is requested.
AgentApprovalCard is controlled presentation; the host owns approval state
and submits its callbacks.
AgentAskQuestion answers single-choice items as soon as an option is picked
and also accepts a typed custom answer. The host owns pending answers, errors,
and response transport. Multiple-choice items set multiple: true and provide
onAnswers for explicit array submission.
AgentComposer and its body, field, textarea, actions, attachments, and settings
primitives share the desktop input presentation without taking ownership of
drafts, keyboard handling, models, uploads, or runtime actions. See the
composer adoption contract.
AgentPromptQueue renders queued prompts and reports edit, remove, and steer
actions to the host.
The token entry point has no React, Tailwind, font-package, or desktop runtime dependency. Apps provide Inter and Geist Mono themselves, which lets each bundler control font loading and asset emission.
The solid colors in palette.css, the semantic values in tokens.css, and
the mappings in theme.css are the authored sources. bun run generate:theme
derives alpha colors in palette.css, then generates scoped-tokens.css and
the internal component Tailwind mapping. Tests and CI reject drift in all
derived values. Consumers may import either public token entry point.
Theme usage
Existing consumers can keep text-destructive for error text and
bg-destructive text-destructive-foreground for filled actions. The Tailwind
mapping uses --error-text for destructive text and --destructive (the
--error-solid alias) for backgrounds, borders, and rings. The label stays
white through --destructive-foreground. Opacity modifiers, interaction
variants, and the namespaced cline-ui utilities follow the same mapping.
Framework-neutral CSS should use --error-text for readable error text.
For a Tailwind v4 app, import framework and consumer dependencies first:
@import "@fontsource-variable/inter";
@import "@fontsource-variable/geist-mono";
@import "tailwindcss";
@import "@cline/ui/theme/index.css";An app that only needs framework-neutral values can import:
@import "@cline/ui/theme/tokens.css";For an embedded surface, import scoped tokens and optional Markdown styles:
@import "@cline/ui/theme/scoped-tokens.css";
@import "@cline/ui/components.css";
@import "@cline/ui/components/markdown.css";<section className="cline-ui-theme">
<div className="cline-markdown">...</div>
</section>Dark values activate when .dark is on the wrapper or an ancestor.
Embedded hosts should not import @cline/ui/theme/theme.css; it intentionally
maps generic Tailwind names such as bg-background for Cline-owned surfaces.
The theme follows the standard shadcn semantic contract (--background,
--foreground, --card, --primary, --border, --ring, charts, and
sidebar surfaces) and Tailwind theme names. This means shadcn components and
normal Tailwind utilities inherit Cline defaults without custom adapters.
Theme authors work through three layers:
- Cline-owned 12-step solid and alpha palettes: Slate as
--neutral-*, Iris as--accent-*, Vermilion as--error-*, Emerald as--success-*, Amber as--warning-*, and Sky as--info-*. - Readable visual roles such as
--surface-1,--text-2,--border-1, and--success-surface. - Stable shadcn compatibility variables consumed by components.
Prefer visual or status roles when authoring new framework-neutral component
CSS. Continue using standard shadcn names in shadcn-compatible components.
Tailwind exposes the role and compatibility layers, but intentionally does not
register every raw palette step. Brand artwork may use the separate
--brand-* colors.
Iris, Vermilion, and Emerald use Cline brand OKLCH scales. Neutral scales
began with Radix Colors 3.0.0 under the included MIT license. Solid colors are
authored; alpha counterparts are generated to reproduce those colors over each
mode's --neutral-1 within 3/255 per sRGB channel. This equivalence applies over
--neutral-1, not arbitrary host backgrounds. No palette package is required
at runtime.
Use --accent-foreground and the status -text roles for small colored text.
Pair solid fills with their foreground or -contrast roles.
The existing token names and component APIs remain available. Typography adds
--text-xxs for 11px text at the default 15px root size.
Agent-chat usage
Agent-chat consumers must provide React 18.3 or 19. Install React in the consuming application if it is not already present:
bun add react@^19 react-dom@^19Applications already on React 18.3 can retain that compatible version.
In the application's global CSS, import the component styles after at least the theme tokens:
@import "@cline/ui/theme/tokens.css";
@import "@cline/ui/components/agent-chat.css";Then import the React components:
import {
Conversation,
ConversationContent,
ConversationEmptyState,
ConversationScrollButton,
ConversationViewport,
Message,
MessageAction,
MessageActions,
MessageContent,
Reasoning,
ReasoningContent,
ReasoningTrigger,
ToolActivity,
ToolActivityCode,
ToolActivityContent,
ToolActivityDetails,
ToolActivityTrigger,
WorkActivity,
WorkActivityContent,
WorkActivityTrigger,
} from "@cline/ui/components/agent-chat";Conversation owns sticky scrolling, Message owns role presentation,
Reasoning and ToolActivity provide accessible disclosures, ThinkingBlock
is the standard thinking-trace row ("Thinking" shimmer while streaming,
"Thought for Ns" once done), WorkActivity folds a finished run's working
rows behind a "Worked for 4m 12s and made 14 tool calls" summary, and the
smaller action, empty-state, detail, and code primitives fill out common
transcript states.
For assistant Markdown, @cline/ui/components/markdown exports the shared
Streamdown configuration — markdownCodeHighlighter (lazy Shiki with GitHub
light/dark themes), agentMarkdownControls, and the opt-in
createLazyMermaidPlugin / agentMarkdownControlsWithMermaid pair — and
@cline/ui/components/markdown.css carries the matching chat styling (quiet
single-box code blocks with a hover copy control, chat-scale headings, table
cards). The Mermaid plugin dynamically imports the renderer only after a
mermaid fence is encountered and enforces strict security for model-authored
source. Import the CSS unlayered so it wins over Streamdown's Tailwind
utilities, and keep streamdown, shiki, @shikijs/langs, @shikijs/themes,
and (when enabling diagrams) mermaid installed as optional peer dependencies.
Products keep their own <Streamdown> wrapper for link and image policy.
Hosts that want a native-looking diagram block register
createMermaidRenderer() from @cline/ui/components/mermaid-block through
<Streamdown plugins={{ renderers: [createMermaidRenderer()] }} /> instead of
the mermaid diagram plugin (Streamdown consults renderers first, so the
built-in block is skipped). The block shows the diagram's filename in its
header — from the fence title (```mermaid title="my-diagram"), the
diagram's frontmatter title:, or a name derived from its contents — and
offers zoom, fullscreen, copy, and a Download menu with PNG and Mermaid
source (.mmd) only. Diagrams use Mermaid's base theme with variables
resolved from the live design tokens (--card, --foreground, --primary,
...) as concrete sRGB, follow light/dark (.dark on the root) and the accent
palette, and re-render when either changes; a diagram's own %%{init}%%,
frontmatter config:, classDef, and style still override the site theme.
PNG exports are opaque (filled with the surface color), rendered at 2x-3x
(following the device pixel ratio, not Streamdown's fixed 5x), and capped at
4096px on the longest edge, re-encoding smaller if needed, so they stay under
the ~5 MiB image attachment limit. The pure naming, theming, and
sizing logic lives in @cline/ui/components/mermaid-diagram (DOM-free).
Give each conversation a bounded height through an explicit height or a complete flex/min-height chain so its viewport can scroll.
Diagram links need host handling. Mermaid's strict mode blocks scripts and
dangerous URL schemes, but a click <node> "https://…" directive still renders
a live anchor inside the SVG, and Streamdown injects that SVG with
dangerouslySetInnerHTML — so it never passes through the a component a
product supplies. The plugin therefore runs neutralizeDiagramLinks over
rendered output: navigable href / xlink:href / target attributes are
removed, and an http(s) destination is preserved on the attribute exported as
DIAGRAM_LINK_HREF_ATTRIBUTE (data-cline-diagram-href). Diagram links are
inert by default; a host that wants them clickable should read that attribute
and route the destination through its own link policy. Treat them as untrusted:
a diagram's visible label is authored independently of its destination, so
confirm before opening rather than reusing a "looks honest" heuristic.
These are presentation primitives, not an agent SDK. Consumers map their own message and tool schemas into the components and retain their own Markdown, transport, approvals, persistence, and product actions.
Session-row presentation
The root entry exports AgentSessionRow, AgentSessionRowEditor, and
AgentSessionOverview. Desktop uses these for its existing session row, rename
frame, and hover metadata. Hosts retain their icons, actions, rename input,
menus, data formatting, and session behavior. See the session-row section in
ADOPTION.md for the slot and trigger/ref contract.
Storybook
Run the interactive component catalog from the repository root:
bun -F @cline/ui storybookThen open http://localhost:6006. Build the static catalog with:
bun -F @cline/ui build-storybookIn the repository's agent sandbox, bind to a forwarded host and unused port:
bun -F @cline/ui storybook -- --host 0.0.0.0 --port 3490 --exact-portThe catalog includes the theme foundations and representative agent-chat states in light, dark, desktop, and narrow viewports.
Storybook currently runs from a Cline monorepo checkout. It is not hosted or included in the npm package; deployment can be added once the catalog and ownership model settle.
Layering and compatibility
- Import the Cline theme after Tailwind so its default typography values win.
- Import
components/markdown.cssafter either token entry point. - Import
agent-chat.cssafter theme tokens. - Override
:rootor.darkafter package imports for deliberate product variations; do not rename the default semantic contract. base.cssis optional because it contains opinionated Markdown and global interaction styles.- Shell layout, routes, provider/session state, and runtime behavior stay with each consumer.
- Contract changes should include a compatibility note, package tests, a Storybook build, and at least one real consumer build.
Releases
@cline/ui is released with the SDK packages and shares their version. The
sdk-publish.yml workflow (or bun release sdk locally) publishes it after
@cline/sdk: production releases use the npm latest tag and nightly builds
use nightly. See Publishing.
Earlier standalone releases used 0.1.0 and 0.2.0-next.N. The SDK moved to
0.2.0 when the UI joined it, so SDK releases continue that version line.
0.2.0-next.10 compatibility notes
This preview packages the already-merged desktop UI updates for external consumers:
SearchCombobox.onOpenis an optional callback for refreshing a catalog when its picker opens. Hosts still own fetching, selection, and error handling.- A single queued prompt is visible immediately with its existing edit/remove/ steer controls. Multiple prompts retain the collapsible list. This does not add a runtime queue operation or an Enter-to-steer shortcut to consumers.
ToolFileDiffderives its options from the peer component, allowing the published declarations to work with both@pierre/diffs1.3 and 1.4.
Consumers on 0.2.0-next.9 can retain existing props. Adopt the callback
explicitly to enable catalog refresh.
Monorepo consumers retain workspace:*; rebuild with bun -F @cline/ui build
and restart the consuming app. External consumers should pin an exact version,
commit their lockfile, and update deliberately. The package is ESM and its
React components target browser applications. A complete Tailwind theme also
requires Tailwind v4 and the two font packages shown above.
AgentContextUsage supplies the desktop context ring, accessible trigger label,
and usage-detail body through a render callback. The host keeps its existing
button/popover behavior and passes its formatted cost separately from the latest
request's context tokens. See context usage.
UX verification reports
AgentUxVerification renders the shared UxVerificationReport contract from @cline/shared/browser as an evidence carousel. It supports passed/failed/blocked checks, titles, observations, thumbnails, keyboard navigation and optional slideshow. Pass state="running" while verification runs, then state="completed" with its report. Invalid output or state="error" displays a failure state rather than a success count.
Inline screenshots use the existing safe Blob renderer. Hosts can supply renderScreenshot(check, className, presentation) to resolve authenticated asset references, and onExpandScreenshot(check) to open their focus-managed image viewer. The component owns no transport or upload client. Its styles ship in @cline/ui/components.css; see the Agent/UX verification Storybook stories.
When the carousel has focus, Left/Right switch slides and Space toggles slideshow playback without scrolling the page. Arrow navigation pauses playback. Space on a focused button retains that button’s normal action.
Screenshot evidence uses the existing GeneratedMedia image contract: id, modality: "image", a supported raster mediaType, and source (base64, url, or artifact). Optional name and sizeBytes metadata are preserved. Persist artifact IDs in reports and let the host resolve access URLs when displaying them; the shared component does not invent or refresh signed URLs.
A Desktop consumer can pass check.screenshot directly to its existing ArtifactImage component from the cloud-artifact integration, without converting between image formats:
<AgentUxVerification
output={report}
state="completed"
renderScreenshot={(check, className, presentation) =>
check.screenshot?.source.type === "artifact" ? (
<ArtifactImage
media={check.screenshot}
sessionId={sessionId}
className={className}
interactive={presentation !== "thumbnail"}
/>
) : undefined
}
/>ArtifactImage belongs to the Desktop host, not this package. Other hosts supply their own media renderer. Unresolved URL and artifact sources show a resolver-required placeholder by default; inline base64 sources use GeneratedMediaContent. See the Artifact reference Storybook example.
A host renderer can return undefined to keep the shared default renderer for a source it does not own. For example, an artifact renderer returns undefined for inline screenshots so the shared Blob rendering and image-load fallback stay active.
presentation is "slide" or "thumbnail". Thumbnail content lives inside the selection button and must not render buttons, links or other interactive controls. Hosts should disable retry controls in that context while keeping recovery available in the main view. GeneratedMediaContent shows its unavailable fallback if inline image bytes fail to decode, including in expanded host viewers.
