Keyboard shortcuts

Press or to navigate between chapters

Press ? to show this help

Press Esc to hide this help

UI component system [SPEC]

Version: 2.0.0 Last Updated: 2026-03-14 Package: packages/ui/


Reader orientation: This document specifies @bardo/ui, the shared React component library for all Bardo web surfaces (Portal dashboard, debug UI, browser SPA). It belongs to the interfaces layer and implements the ROSEDUST design language (rose on violet-black surfaces with restrained bone accents). This is NOT the Golem’s primary interface; that is the TUI (bardo-terminal), a separate Rust/ratatui application. Key concepts: Golem (a mortal autonomous DeFi agent), the Portal (web dashboard for agent setup and analytics, see 00-portal.md), and the bardo-sprites WASM module for creature rendering. For unfamiliar terms, see prd2/shared/glossary.md.

Overview

@bardo/ui is the shared React component library for all Bardo web surfaces. It implements the ROSEDUST design language – rose on violet-black surfaces with restrained bone accents that communicate safety, precision, and sophistication.

This library serves the Portal (web dashboard), debug UI, and browser SPA. It is not the Golem’s primary UI. The Golem’s primary interface is the TUI (bardo-terminal), a separate Rust/ratatui application. The React components here are for web surfaces where TypeScript and React are the right tools: onboarding wizards, analytics dashboards, reputation profiles.

The package is internal (no npm publish), consumed via direct TypeScript source imports.


Scope boundaries

SurfaceUI SystemWhere Defined
Portal@bardo/ui (React)This document
Debug UI@bardo/ui (React)This document
TUI (primary)ratatui (Rust)../../13-runtime/14-creature-system.md (specifies the Golem creature sprite system and runtime rendering)
Creature viewportbardo-sprites WASM../../13-runtime/14-creature-system.md (procedural creature generation and animation)

The web Portal can render creatures by embedding the bardo-sprites WASM module in an HTML5 Canvas – same procedural generation as the TUI, different rendering target. But the creature interaction model (pet, steer, dream visualization, death cinematic) lives in the TUI, not the web components.


Design philosophy

Core principles

  1. ROSEDUST – Near-black surfaces (bg_void #060608) with rose as the primary color and restrained bone accents. Bone is earned, not decorative. Every bone element signals something meaningful: the single most important element on screen.

  2. Engineering aesthetic – PCB traces, hexagonal connectors, octagonal clip-paths, monospaced data. Hardware metaphors ground abstract financial concepts.

  3. Glass over void – Layered transparency creates depth without color. Glass cards float above the void-dark base. Backdrop blur separates content layers.

  4. Typography as hierarchy – Three fonts, three purposes. Serif for authority. Mono for data and truth. Sans for comfortable reading.

  5. Motion as meaning – Luxury-eased animations with deliberate pacing. Nothing snaps. Nothing bounces. Elements glide into position.

  6. Restraint – Dark surfaces need empty space. Gold loses its power when overused.


Color system

Foundation palette

TokenValueUsage
--black#0A0A0APage background, deepest surface
--surface#111111Elevated sections
--surface-2#161616Secondary elevation (sidebar, panels)

Never use pure #000000. The 0A0A0A black has enough warmth to prevent the “hole in the screen” effect.

Gold system

TokenValueUsage
--gold#C9A84CPrimary brand – headlines, active states, CTAs
--gold-dimrgba(201, 168, 76, 0.20)Borders at rest, subtle dividers
--gold-midrgba(201, 168, 76, 0.40)Borders on hover, scrollbar thumb
--gold-glowrgba(201, 168, 76, 0.05)Hover backgrounds, ghost button fills

Tier color system

TierNameColorHex
IUnverifiedGray#4A4A4A
IIBasicCopper#8B5E3C
IIIVerifiedSilver#A0A0A8
IVTrustedGold#C9A84C
VSovereignAmber#E8A020

Debug UI adaptations

The debug UI (developer-facing) uses a blue-shifted color variant:

TokenDebug ValuePurpose
--black#0D1117Blue-shifted base
--surface#161A20Cooler surface elevation
--surface-2#1E2430Secondary elevation

Typography

TokenFontPurpose
--font-serifInstrument SerifDisplay headlines, hero text, section titles
--font-sansGeneral SansBody copy, UI text, descriptions, navigation
--font-monoJetBrains MonoAddresses, numbers, code, data values

Scale

LevelSizeWeightFontUsage
Display72px400SerifHero headlines only
H148px500SerifPage titles
H232px500SerifSection headers
H324px500SansSubsection headers
Body16px400SansParagraph text
Small14px400SansLabels, metadata
Mono14px400MonoAddresses, values

Glass morphism system

Three elevation levels:

LevelBackgroundBorderBlur
Glass-1 (Subtle)rgba(255,255,255,0.02)rgba(255,255,255,0.05)12px
Glass-2 (Standard)rgba(255,255,255,0.04)rgba(255,255,255,0.08)20px
Glass-3 (Prominent)rgba(255,255,255,0.06)rgba(255,255,255,0.12)30px

Component library

Layout

ComponentPurpose
PageLayoutFull-page wrapper with sidebar, header, content area
GlassCardGlass morphism container with configurable elevation
PcbCardPCB-traced card for hero statistics
SectionPage section with optional title and gold divider
SidebarNavigation sidebar with active state indicators

Data display

ComponentPurpose
DataTableColumn-aligned table with sort, filter, pagination
StatCardKey metric display with label, value, trend indicator
AddressDisplayTruncated address with copy button and explorer link
TokenAmountFormatted token amount with symbol and decimals
TierBadgeReputation tier indicator with metal color
PriceChartRecharts line chart with rose accent styling
LiquidityChartTick-range bar chart for V3/V4 position visualization

Input

ComponentPurpose
TokenInputAmount input with token selector and balance display
AddressInputAddress input with validation and ENS resolution
RangeSliderTick range selector for LP positions
ChainSelectorChain dropdown with chain icons

Feedback

ComponentPurpose
SpinnerAnimated loading indicator (gold dots)
ToastNotification system with auto-dismiss
ConfirmDialogTransaction confirmation with detail breakdown
ProgressBarScenario progress with step count
AlertBannerFull-width status banner (info, warning, error)

Hooks

HookPurpose
useRechartsLazy-loads recharts via dynamic import to avoid bundle bloat
useThemeTheme context (production vs debug UI color variants)
useTierColorReturns metal color for a given reputation tier
useTokenFormatFormats BigInt amounts with correct decimals and symbol
useAddressTruncateTruncates address with configurable prefix/suffix length
useAutoRefreshPolling hook with configurable interval and watchBlocks support
useClipboardCopy-to-clipboard with toast feedback
useMediaQueryResponsive breakpoint detection

Animation system

Timing functions

TokenValueUsage
--ease-luxurycubic-bezier(0.22, 1, 0.36, 1)Primary easing – all standard transitions
--ease-subtlecubic-bezier(0.25, 0.46, 0.45, 0.94)Micro-interactions, hover states
--ease-bouncecubic-bezier(0.34, 1.56, 0.64, 1)Emphasis (used sparingly)

Motion patterns

  • Page fade-in: 250ms opacity transition on mount
  • Stagger delays: 50ms per item in lists
  • Card hover: 200ms scale(1.01) + border color transition
  • Scroll reveal: IntersectionObserver with 100px threshold, 400ms fade-up

Tech stack

LibraryVersionPurpose
React^19.0UI framework
Tailwind CSS^4.0Utility-first styling (CSS-first config)
Radix UIlatestAccessible primitive components
recharts^2.0Charts (lazy-loaded via useRecharts)
shadcn/uilatestComponent templates (Radix + Tailwind)

Package configuration

{
  "name": "@bardo/ui",
  "private": true,
  "type": "module",
  "exports": {
    ".": { "types": "./src/index.ts", "default": "./src/index.ts" },
    "./*": { "types": "./src/*.ts", "default": "./src/*.ts" }
  },
  "peerDependencies": {
    "react": "^19.0.0",
    "react-dom": "^19.0.0"
  }
}

Internal package – no build step. Consumers import TypeScript source directly. Test environment uses happy-dom.


Context-specific adaptations

FeatureLanding PagePortalDebug UI
Gold systemFullFullFull
Glass cardsFullFullFull
PCB cardsHero statsHero statsHero stats only
Film grainYesNoNo
Custom cursorYesNoNo
Color base#0A0A0A#0A0A0A#0D1117 (blue-shifted)

Accessibility

  • All interactive elements have visible focus indicators (gold ring)
  • Color contrast ratio >= 4.5:1 for text, >= 3:1 for large text
  • Radix UI primitives provide keyboard navigation and ARIA attributes
  • prefers-reduced-motion disables all animations except opacity transitions
  • Screen reader text provided for icon-only buttons