Onlook: UI/UX Framework Deep Dive

Part One: Global Design System

Onlook represents the evolution of design tools—a “Cursor for Designers” that bridges the gap between visual design and production code. The UI/UX framework embodies professional-grade design tool aesthetics with the power of real-time code manipulation.

1.1 Overall Visual Identity

Onlook’s design philosophy centers on “Invisible Interface”—the UI should never distract from the creative process. Every element is crafted to feel like a natural extension of the designer’s intent, using glassmorphism, contextual intelligence, and micro-animations to create an interface that feels alive yet unobtrusive.

The aesthetic draws inspiration from professional creative software (Figma, VS Code, Sketch) while innovating with adaptive transparency, smart overlays, and real-time visual feedback that makes code editing feel as intuitive as moving objects in a design canvas.

1.2 Semantic Color System

Onlook uses a sophisticated dual-mode color system that adapts intelligently between light and dark themes. The color architecture is built on HSL-based semantic tokens that maintain perfect contrast ratios across all interface states.

Color FamilyLight ModeDark ModeSemantic PurposeDesign Intent
Purple Brand
#C174FF
#AE4AFF
Primary actions, focus states, brand identityCreativity and innovation in design tools
Red Destructive
#FF5B82
#FA003C
Delete actions, errors, warningsClear danger signaling with emotional impact
Blue Information
#90D1FF
#109BFF
Links, info states, secondary actionsTrust and reliability for guidance
Teal Accent
#00DEBA
#00C1A2
Success states, highlights, accentsFresh, modern energy for positive feedback
Green Success
#00E14B
#00C441
Confirmations, positive feedbackNatural success indication
Gray Neutrals
#F5F5F5
#1A1A1A
Backgrounds, borders, text hierarchyProfessional foundation with perfect contrast

Advanced Semantic Tokens: The system uses CSS custom properties that automatically adapt between themes:

  • Background tokens create contextual surfaces that respond to user focus
  • Foreground hierarchy ensures optimal readability across all interface states
  • Toolbar backgrounds use semi-transparent values for glassmorphism effects
1.3 Typography System

Onlook employs system fonts for optimal performance and native feel across all operating systems. The typography hierarchy uses precise pixel sizing with optimized letter-spacing for maximum readability at all scales.

Primary Typeface: System font stack prioritizing native OS fonts

  • macOS: SF Pro Display/Text
  • Windows: Segoe UI Variable
  • Linux: System UI fallbacks

Font Loading Strategy: No custom fonts are loaded to ensure instant rendering and optimal performance across all devices and network conditions.

TokenSizeWeightLetter SpacingUsage ContextDesign Purpose
title136px400autoMain headers, app brandingMaximum visual impact
title224px400normalSection headers, dialog titlesClear hierarchy
title320px400normalSubsection headers, card titlesOrganized content structure
largePlus18px5000.02remEmphasized UI text, primary buttonsImportant interactive elements
large18px4000.02remStandard UI text, secondary buttonsReadable interface text
regularPlus15px5000.02remForm labels, emphasized body textFunctional emphasis
regular15px3000.02remBody text, descriptionsPrimary reading text
smallPlus13px5000remMetadata, emphasized captionsCompact information
small13px3000remSecondary information, help textSupporting details
mini12px4000.01remStatus indicators, badgesCompact UI elements
micro11px4000.005remTooltips, fine printMinimal information display
1.4 Glassmorphism & Depth System

Onlook pioneered contextual glassmorphism where transparency and blur adapt to content and user focus. The depth system creates visual layering without heavy shadows.

Glass Effect Implementation:

  • Primary panels use 95% background opacity with 20px backdrop blur
  • Floating toolbars use 85% opacity with 40px backdrop blur for enhanced separation
  • Subtle borders (0.5px) define panel edges without harsh lines
  • Multi-layer shadows create realistic depth perception
1.5 Animation & Micro-interactions

Every animation serves a functional purpose—providing feedback, guiding attention, or smoothing transitions. The timing curves are carefully crafted for perceived performance.

AnimationDurationEasingPurposeImplementation
Panel Slide-in1000mseasePanel appearance/disappearanceHorizontal translation from hidden to visible
Toolbar Rise1250mseaseContextual toolbar appearanceVertical translation with opacity fade
Button Press150msease-outTactile feedbackScale transformation for press effect
Hover Transitions200mseaseInteractive state changesColor and opacity transitions
Loading Shimmer1500mslinear infiniteContent loading statesBackground position animation

Part Two: Interface Analysis

2.1 Interface Overview

Onlook’s main interface consists of five primary zones that work together to create a comprehensive design-to-code workflow:

Layout Architecture:

  • Top Bar (40px fixed height): Global navigation, mode switching, and publish controls
  • Left Panel (280px default, resizable): Project structure, brand assets, and page management
  • Canvas (flexible center area): Live website preview with visual editing capabilities
  • Right Panel (352px/700px adaptive): AI chat assistant and integrated code editor
  • Bottom Panel (collapsible): Terminal interface for development commands
  • Floating Editor Bar: Context-sensitive styling controls that appear above the canvas
2.2 Main Canvas Interface

UI/UX Design: The canvas is the heart of Onlook’s innovation—a live iframe displaying the actual website with sophisticated overlay systems for visual editing. The interface combines the familiarity of web browsing with the precision of design tools.

Visual Feedback System:

  • Hover State: Blue outline (1px) appears when hovering over elements
  • Selection State: Purple outline (2px) with resize handles for selected elements
  • Box Model Visualization: Diagonal stripe patterns show margins (blue) and padding (green)
  • Measurement Guides: Distance indicators appear between elements during interactions
  • Element Labels: Contextual tags show HTML element types and CSS classes

Technical Implementation: The canvas uses iframe communication to establish a bridge between the editor and the live website. A sophisticated coordinate transformation system handles zoom, pan, and responsive breakpoint changes. The overlay system renders SVG elements that perfectly align with DOM elements using real-time position calculations.

Interaction Patterns: Element selection triggers a cascade of interface updates: the selected element gets visual highlighting, the Editor Bar appears with contextual controls, and the left panel updates to show the element in the layers tree. All interactions provide immediate visual feedback with smooth animations.

AI Reproduction Prompt:

Prompt
Create a sophisticated canvas interface for a visual web editor using React, TypeScript, and SVG overlays.
 
**Core Requirements:**
- Render a website in an iframe with full interaction capabilities
- Implement an SVG overlay system that perfectly aligns with DOM elements
- Support zoom and pan functionality with coordinate transformation
- Provide visual feedback for hover, selection, and measurement states
 
**Visual Design Specifications:**
- Hover outline: 1px solid blue (#90D1FF) with subtle glow effect
- Selection outline: 2px solid purple (#C174FF) with corner resize handles
- Margin visualization: Blue diagonal stripes at 45° angle, 10% opacity
- Padding visualization: Green diagonal stripes at 45° angle, 10% opacity
- Measurement lines: Thin gray lines with pixel value labels
- Element labels: Small badges showing tag names and classes
 
**Interaction Features:**
- Click to select elements with multi-select support (Cmd/Ctrl+click)
- Drag to move absolutely positioned elements
- Resize handles on corners and edges for selected elements
- Right-click context menu with common actions
- Keyboard shortcuts for common operations (Delete, Duplicate, etc.)
 
**Technical Implementation:**
- Use postMessage API for iframe communication
- Implement coordinate transformation functions for zoom/pan states
- Use SVG patterns and masks for margin/padding visualization
- Handle mouse events with proper event capture for dragging operations
- Support responsive breakpoint switching with smooth transitions
 
**Performance Considerations:**
- Debounce mouse move events to prevent excessive updates
- Use requestAnimationFrame for smooth overlay animations
- Implement virtual rendering for large numbers of overlay elements
- Cache coordinate calculations to avoid redundant computations
2.3 Contextual Editor Bar

UI/UX Design: The Editor Bar represents Onlook’s signature innovation—a smart toolbar that dynamically adapts its content based on the type of element selected. This contextual approach eliminates interface clutter while providing precisely the right tools for each editing context.

Adaptive Content System:

  • Text Elements: Typography controls (font family, size, weight, color, alignment)
  • Container Elements: Layout controls (background, border, spacing, display properties)
  • Image Elements: Media controls (background images, object fit, opacity)
  • Frame Selection: Device and viewport controls (responsive breakpoints, themes)

Visual Design: The toolbar uses glassmorphism with a semi-transparent background and backdrop blur to maintain focus on the canvas while providing clear tool separation. Controls are organized into logical groups with subtle separators, and less critical controls move to an overflow menu when space is constrained.

Technical Implementation: The Editor Bar uses dynamic component rendering based on element type detection through DOM analysis. A sophisticated dropdown management system ensures only one control panel is open at a time, and all changes trigger immediate updates to both the visual canvas and underlying code through AST manipulation.

Animation Behavior: The toolbar appears with an upward sliding motion when elements are selected and disappears smoothly when selection is cleared. Internal content transitions smoothly between different element types without jarring layout shifts.

AI Reproduction Prompt:

Prompt
Create a dynamic, contextual toolbar for a visual web editor using React, TypeScript, Framer Motion, and Tailwind CSS.
 
**Core Architecture:**
- Implement element type detection system that analyzes selected DOM elements
- Create modular control groups that can be dynamically rendered based on context
- Build responsive width management that adapts to available screen space
- Implement overflow menu system for constrained layouts
 
**Visual Design System:**
- Use glassmorphism: semi-transparent background (95% opacity) with 20px backdrop blur
- Apply subtle border (0.5px) and rounded corners (12px) for modern appearance
- Organize controls in horizontal groups with 1px separator lines
- Use consistent 8px padding and 4px gaps between elements
- Implement subtle drop shadow for elevation
 
**Control Group Organization:**
Text Element Controls:
- Font family dropdown with system font preview
- Font size input with increment/decrement buttons  
- Font weight selector with visual weight samples
- Text color picker with brand color integration
- Text alignment buttons (left, center, right, justify)
- Advanced typography panel (line height, letter spacing)
 
Container Element Controls:
- Background color picker with gradient support
- Border controls (width, style, color for each side)
- Border radius controls with corner-specific adjustment
- Padding controls with visual box model representation
- Margin controls with auto value support
- Display property selector (flex, grid, block, inline)
 
Image Element Controls:
- Background image uploader with preview
- Object fit selector (cover, contain, fill, etc.)
- Opacity slider with percentage display
- Border radius for image styling
 
**Interaction Patterns:**
- Animate toolbar entrance: slide up from 20px below with fade in (300ms ease)
- Smooth content transitions when switching between element types
- Dropdown panels open with scale and fade animation
- All control changes trigger immediate visual feedback
- Implement keyboard shortcuts for common actions
 
**Responsive Behavior:**
- Monitor available width between left and right panels
- Move secondary controls to overflow menu when width < 600px
- Overflow menu triggered by three-dot button with slide-down animation
- Maintain full functionality in collapsed state
 
**Technical Requirements:**
- Use React Context for managing dropdown open/closed states
- Implement debounced updates to prevent excessive re-renders
- Support undo/redo for all toolbar actions
- Integrate with project's styling system for consistent theming
- Handle edge cases like multi-element selection gracefully
2.4 Brand Color Management Panel

UI/UX Design: The Brand panel transforms color management from a developer task into a designer-friendly experience. It automatically discovers colors used throughout the project and organizes them into semantic groups, providing centralized control over the design system.

Smart Color Organization:

  • Automatic Detection: Scans all project files to discover existing colors
  • Semantic Grouping: Groups similar colors into logical families (primary, accent, neutral)
  • Usage Analytics: Shows how many times each color appears across the project
  • Live Updates: Changes to brand colors instantly propagate throughout the codebase

Interface Design: The panel uses expandable accordion sections for each color group, with smooth animations for opening and closing. Each color displays as a circular swatch with hex value, usage count, and inline editing capabilities. Context menus provide actions like duplicate, rename, and delete.

Technical Implementation: The system uses color parsing libraries to handle format conversion and similarity detection. It maintains a live connection to the project’s file system to track color usage and can perform bulk find-and-replace operations when colors are modified. All changes support undo/redo functionality.

Export Integration: Colors can be exported as CSS custom properties, JSON design tokens, or Figma variables, enabling seamless integration with existing design workflows and handoff processes.

AI Reproduction Prompt:

Prompt
Create a comprehensive brand color management system for a visual web editor using React, TypeScript, and advanced color manipulation.
 
**Core Functionality:**
- Implement automatic project scanning to discover all colors in use
- Create intelligent color grouping based on hue similarity and usage patterns  
- Build real-time usage tracking that shows where each color appears
- Support bulk color replacement with live preview of changes
- Integrate eyedropper tool for sampling colors from the canvas
 
**Visual Interface Design:**
- Expandable color groups with smooth accordion animations (300ms ease)
- Circular color swatches (32px diameter) with subtle border and hover effects
- Inline editing with focus states and real-time validation
- Usage count badges showing number of instances across project
- Context menus with duplicate, rename, delete, and export options
- Theme toggle for viewing colors in light/dark contexts
 
**Color Group Organization:**
- Primary colors: Main brand colors and their variations
- Secondary colors: Accent and supporting colors
- Neutral colors: Grays, whites, blacks for text and backgrounds  
- System colors: Success, warning, error, and info states
- Custom groups: User-defined color families
 
**Advanced Features:**
- Color similarity detection using Delta E color difference algorithms
- Automatic shade generation (lighter/darker variants of base colors)
- Color accessibility checking with WCAG contrast ratio validation
- Bulk operations for renaming, replacing, or organizing colors
- Integration with popular design token formats
 
**Technical Implementation:**
- Use chroma-js or similar library for color space calculations and conversions
- Implement file system watching to detect color changes in real-time
- Create AST parsing for CSS, SCSS, and JavaScript files to locate color usage
- Build debounced update system to prevent excessive file operations
- Support multiple color formats: hex, rgb, hsl, css variables
 
**Export Capabilities:**
- CSS custom properties with semantic naming conventions
- JSON design tokens compatible with Style Dictionary
- SCSS variables with proper organization and comments
- Figma variables export for design handoff
- Tailwind CSS configuration integration
 
**Interaction Patterns:**
- Drag and drop to reorder colors within groups
- Click to edit color with inline color picker
- Double-click to rename color with validation
- Right-click for context menu with advanced options
- Keyboard shortcuts for common operations (Cmd+D for duplicate)
 
**Performance Considerations:**
- Virtual scrolling for projects with large numbers of colors
- Lazy loading of color usage analysis for better initial load times
- Efficient caching of color calculations and file parsing results
- Optimistic updates with rollback capability for failed operations
Functional RoleCode FileDescription
Design Token Systempackages/ui/tokens.ts, packages/ui/tailwind.config.tsCore color palette, typography scales, and semantic design tokens
Global CSS Variablespackages/ui/src/globals.cssCSS custom properties for light/dark themes and animation keyframes
Button Component Systempackages/ui/src/components/button.tsxMulti-variant button component with CVA styling system
Editor Bar Implementationapps/web/client/src/app/project/[id]/_components/editor-bar/index.tsxDynamic contextual toolbar with element-type detection
Text Controlsapps/web/client/src/app/project/[id]/_components/editor-bar/text-selected.tsxTypography and text styling controls for selected text elements
Visual Overlay Systemapps/web/client/src/app/project/[id]/_components/canvas/overlay/elements/SVG-based element selection, hover states, and resize handles
Selection Rectangleapps/web/client/src/app/project/[id]/_components/canvas/overlay/elements/rect/click.tsxPurple selection outline with margin/padding visualization
Resize Handlesapps/web/client/src/app/project/[id]/_components/canvas/overlay/elements/rect/resize.tsxInteractive resize handles with coordinate transformation
Measurement Systemapps/web/client/src/app/project/[id]/_components/canvas/overlay/elements/measurement.tsxDistance measurement guides between elements
Panel Layout Systemapps/web/client/src/app/project/[id]/_components/main.tsxFive-panel editor layout with glassmorphism effects
Left Panel Implementationapps/web/client/src/app/project/[id]/_components/left-panel/index.tsxTabbed sidebar with Layers, Brand, Pages, Images, Branches
Right Panel Implementationapps/web/client/src/app/project/[id]/_components/right-panel/index.tsxChat and Code tabs with resizable panel system
Brand Color Managementapps/web/client/src/app/project/[id]/_components/left-panel/brand-tab/color-panel/index.tsxCentralized color palette management with auto-detection
Resizable Panel Systempackages/ui/src/components/resizable.tsx, packages/ui/src/components/sidebar.tsxCore resizable and collapsible panel primitives