Back to Copilotkit

Threads Drawer — Theming Contract

examples/integrations/langgraph-python/src/components/threads-drawer/THEME.md

1.59.55.6 KB
Original Source

Threads Drawer — Theming Contract

The threads-drawer is a BASE component. It is fully driven by CSS variables and contains no hardcoded colors, shadows, or surface radii. To theme it for an example, (re)define the tokens below on any ancestor (e.g. :root, body, or a wrapper element) — never edit the drawer files.

The drawer first consumes the shared design-system tokens (--card, --border, --radius, …) that ui/card.tsx and ui/button.tsx also consume. For a handful of drawer-specific visuals (scrim, shadows, delete-hover tint) it exposes dedicated --threads-* tokens, each with a fallback to a shared token or the original literal — so defining nothing reproduces the default look exactly.

Shared design-system tokens consumed

TokenControls
--backgroundTooltip text color (color: var(--background) on the dark tooltip body)
--foregroundDrawer/dialog title + body text, active segment text, tooltip surface bg
--cardDrawer surface bg (via --threads-drawer-bg), active segment bg, empty/dialog/load-more bg
--borderDrawer + header + filter + dialog borders, thread accent (idle), selected-row inset ring, secondary-button hover bg, tooltip border
--radiusDrawer/dialog/button/segment/thread/empty-card radii; tooltip radius derives from it
--primaryNew-thread button bg, primary dialog button bg, selected thread accent
--primary-foregroundNew-thread button text, primary dialog button text
--secondaryIcon-button + thread-row + load-more hover bg, segment track, archived badge bg, secondary dialog button bg, loading skeleton bars, thread-enter start bg
--secondary-foreground(locked-state) inline code text
--muted-foregroundIcon-button idle color, segment idle text, meta text, placeholder/archived titles, empty/dialog description, load-more text, collapsed-rail icon
--accentSelected thread-row bg
--ringFocus-visible outline on buttons, thread items, segments, dialog buttons
--destructiveDelete-button icon color + delete-hover text
--destructive-foregroundDestructive dialog button text
--font-bodyHeader, segments, tooltip, empty card, and dialog typography

(locked-state additionally uses --secondary, --muted-foreground, --border, --radius, --secondary-foreground, and the ui/card + ui/button tokens via those components.)

Drawer-specific tokens (with fallbacks)

TokenControlsFallback
--threads-drawer-bgDrawer surface backgroundvar(--card)
--threads-drawer-borderDrawer right border colorvar(--border)
--threads-drawer-shadowOpen-drawer drop shadow4px 0 20px rgb(0 0 0 / 0.04)
--threads-segment-active-shadowActive filter-segment shadow0 1px 2px rgb(0 0 0 / 0.06)
--threads-delete-hover-bgDelete-button hover/focus background tintcolor-mix(in srgb, var(--destructive) 10%, transparent)
--threads-overlay-bgConfirm-dialog overlay scrimrgb(0 0 0 / 0.5)
--threads-dialog-shadowConfirm-dialog drop shadow0 20px 50px rgb(0 0 0 / 0.25)
--threads-tooltip-radiusAction-button tooltip corner radiuscalc(var(--radius) - 0.45rem) (= 0.3rem at default)

All fallbacks resolve to the original hardcoded values in the north-star, so an example that defines none of the --threads-* tokens renders pixel-identical to the pre-tokenization drawer.