Repository navigation
Developer Guide Creating UI Components
Sudharsan Selvaraj edited this page Jul 20, 2026
·
1 revision
The TokenPrint UI (everything outside the 3D canvas) is built using React and Tailwind CSS. This guide covers how to add new panels, buttons, or HUD elements.
The AppShell uses a strict CSS Grid. If you add a floating div with absolute positioning arbitrarily, it may overlap the 3D canvas in ways that break the user experience across different screen sizes.
The AppShell defines explicit areas: top, side, canvas, right, and bot.
- Determine which grid area it belongs in (e.g., Developer tools go in the
RightPanelorSidebar). - Create the component in
frontend/components/ui/. - Use Tailwind for styling. Stick to grayscale colors (
bg-gray-800,text-gray-200) to avoid clashing with the 3D scene's data-driven colors. - If the panel needs to read data from the 3D scene (like the hovered tensor), use Zustand (
useStore(state => state.hoveredTensor)). Do not pass props down through the AppShell.
import { useStore } from '@/lib/store';
export function ClearCacheButton() {
const clearCache = useStore(state => state.clearCache);
return (
<button
className="px-2 py-1 bg-gray-700 hover:bg-gray-600 rounded text-xs text-white"
onClick={clearCache}
>
Clear Cache
</button>
);
}flowchart TD
Store[Zustand Store] --> UI[New React Component]
UI --> Tailwind[Tailwind Grayscale Styles]
Tailwind --> Grid{AppShell Grid Placement}
Grid -- Sidebar --> Side[Left Side]
Grid -- RightPanel --> Right[Right Side]
Grid -- TopBar --> Top[Top]
| Previous | Home | Next |
|---|---|---|
| Adding a New Model | Home | Debugging |
TokenPrint Wiki | Home | Getting Started | User Guide | Concepts | Architecture | API | GitHub
TokenPrint is an interactive 3D visualization platform for exploring transformer architectures, tensors, and real-time LLM inference.
- User Guide
- Architecture Explorer
- Live Inference
- Tensor Inspector
- Camera Controls
- HUD
- Timeline
- Scene Navigation
- Transformer Concepts
- Tokenization
- Embeddings
- Positional Encoding
- RoPE
- Multi-Head Attention
- KV Cache
- LayerNorm
- Feed Forward Network
- Residual Connections
- Logits
- Softmax
- Sampling
- Autoregressive Generation
- Visualization System
- Scene Graph
- Geometry
- Materials
- Animation System
- Color Mapping
- Camera System
- Interaction Model
- Architecture
- Overall Architecture
- Frontend
- Backend
- WebSocket Protocol
- Data Pipeline
- Renderer
- Event System