Orbit Design System
Relevant source files
The following files were used as context for generating this wiki page:
Orbit is the canonical design system and component library for the Polar platform. It provides a set of type-safe primitives, design tokens, and high-level components built with TypeScript, StyleX, and React. The system is designed to ensure visual consistency across all Polar surfaces by enforcing the use of predefined tokens for layout, spacing, color, and motion, while making the "easy path and the correct path the same" for developers.
Sources: clients/CLAUDE.md:83-85, clients/apps/orbit/src/app/page.tsx:21-23
Architecture and Core Principles
The Orbit system is built on three governing principles that dictate every architectural decision:
- Design by Subtraction: Constraints are treated as features. Orbit utilizes a single spacing scale, a limited set of radii, and semantic colors to prevent design drift.
- Derived, not Decorated: Styles resolve from underlying rules. For example, colors use the CSS
light-dark()function to auto-swap between modes based on a single styling pass. - Precision as Respect: The system targets a technical audience where precision is mandatory. Primitives like
<Box />remove arbitrary values by only accepting typed tokens rather than raw pixels.
Sources: clients/apps/orbit/src/app/page.tsx:8-20, clients/CLAUDE.md:104-106
System Structure
The system is organized into a monorepo structure within the clients/ directory:
packages/orbit/: Contains the core components, design tokens, and style utilities.apps/orbit/: A documentation and component showcase/playground application.
Sources: AGENTS.md:21-27, clients/packages/orbit/package.json:1-10
The <Box /> Primitive
The <Box /> component is the primary layout and style primitive in Orbit. It is a polymorphic, fully type-safe component that compiles typed props into StyleX styles and scoped CSS at build time.
Component Characteristics
- Default Display: Box defaults to
display: flexfor block-level elements. - Polymorphism: Through the
asprop, it can render as various HTML elements includingdiv,span,section,ul,li,nav, etc. - Token-First: visual concerns (layout, spacing, color, borders) are handled through typed props that consume tokens rather than Tailwind classes or raw values.
Sources: clients/CLAUDE.md:92-111, clients/packages/orbit/src/components/Box.tsx
Visual Composition Flow
The following diagram illustrates how the Box component processes props into the final UI.
The Box component acts as a compiler that translates design tokens into optimized, scoped CSS.
Sources: clients/CLAUDE.md:104-108, clients/CLAUDE.md:173-180
Design Tokens
Tokens are the foundation of Orbit, defined in packages/orbit/src/tokens/tokens.stylex.ts.
Spacing Scale
A single spacing scale powers padding, margin, and gaps to maintain uniform rhythm.
| Token | Value (px) |
|---|---|
none | 0 |
xs | 4 |
s | 8 |
m | 12 |
l | 16 |
xl | 24 |
2xl | 32 |
3xl | 48 |
4xl | 64 |
5xl | 96 |
Sources: clients/apps/orbit/src/app/foundations/spacing/page.tsx:5-16, clients/CLAUDE.md:126-138
Semantic Colors
Colors are categorized by their function and auto-resolve for dark mode.
| Token Group | Key Tokens |
|---|---|
| Background | background-primary, background-secondary, background-card |
| Text | text-primary, text-secondary, text-tertiary |
| Feedback | background-warning, text-success, text-danger |
| Borders | border-primary, border-secondary |
Sources: clients/CLAUDE.md:141-155
Higher-Level Components
Orbit provides specialized primitives that extend or preset <Box /> for specific use cases.
Grid and GridItem
Grid is a Box preset for CSS grid layouts, defaulting to display: grid. It uses shorthand prop names (e.g., templateColumns, gap). GridItem is used for children that require explicit placement or spanning within the grid.
Sources: clients/CLAUDE.md:278-294, clients/CLAUDE.md:304-315
List System
The List system is used for bordered, divided rows in settings and menus. It consists of three main parts:
- List: The container providing the border and radius.
- ListItem: Individual rows with space-between layout for labels and controls.
- ListGroup: A primitive for stacking titled sections separated by borders.
Sources: clients/apps/orbit/src/app/components/list/page.tsx:127-145
Typography
The Text component is the exclusive primitive for typography. It uses variant-driven styles (e.g., heading-l, body, caption, monospace) to ensure consistent font weights, sizes, and line heights.
Sources: clients/CLAUDE.md:102-103, clients/apps/orbit/src/app/page.tsx:43-52
Implementation Standards
Strict UI Rules
- Deprecated
<div>: Standarddivtags with Tailwind classes are deprecated for visual containers. Developers must use<Box />. - No Raw Values: Use of hex codes, oklch, or raw pixel spacing is prohibited.
- Token Overrides: Typed props (e.g.,
padding="m") always win overclassName. - Responsive Design: Styles accept objects keyed by breakpoints (
base,sm,md,lg,xl) and pseudo-states (hover,focus,active).
Sources: clients/CLAUDE.md:92-103, clients/CLAUDE.md:223-233
Dependency Stack
The system relies on several core libraries for its functionality:
- StyleX: For type-safe CSS-in-JS that compiles to static CSS.
- Radix UI: Used for complex accessible primitives like
Select,Tabs, andSwitch. - Lucide React: The standard icon library.
- Motion: For handling transitions and animations using physical curves.
Sources: clients/packages/orbit/package.json:42-53
Conclusion
The Orbit Design System is a rigid, token-driven architecture that prioritizes developer productivity and visual correctness. By centralizing all visual logic in the <Box /> primitive and associated design tokens, Polar ensures that its technical interface remains precise, accessible, and performant across the entire web application ecosystem.