Skip to content

CSS Architecture

All styling in Lakea is centralized in the @lakea/design-system package. Other packages compose these components - they don’t define their own styles.

PackageTailwindStyling approach
design-systemYesTailwind + CSS tokens
uiNoInline styles with DS tokens
viz (planned)NoInline styles with DS tokens
apps/*NoCompose DS + ui + viz
PackageCan importCannot import
coreAny UI packages
design-systemcoreui, viz
uicore, design-systemviz, Tailwind
viz (planned)core, design-systemui, Tailwind
apps/*All packagesTailwind directly
import { Stack, Card, Text, Button } from '@lakea/design-system';
import '@lakea/design-system/styles.css';
function MyComponent() {
return (
<Stack gap="md">
<Card>
<Text variant="h2">Title</Text>
<Text color="muted">Description</Text>
</Card>
<Button variant="primary">Action</Button>
</Stack>
);
}

Use inline styles with design-system tokens for any custom styling:

import { colors, radius, shadows } from '@lakea/design-system/tokens';
const style = {
backgroundColor: colors.slate[800],
borderRadius: radius.lg,
boxShadow: shadows.md,
};

Need a new visual pattern?

  1. Check if @lakea/design-system already has a component for it
  2. If not, add the component to design-system (atom, molecule, or layout)
  3. Use the new component in your app or package

Never add Tailwind classes outside design-system.

design-system
├── tokens (CSS variables + TS exports)
├── atoms (Button, Text, Badge, Link)
├── molecules (Card)
└── layout (Stack, Container)
ui (composes design-system)
└── charts (ScatterPlot, etc.)
viz (planned, composes design-system)
├── d3 bindings
└── three bindings

Design tokens are available as both CSS custom properties and TypeScript exports:

:root {
--ds-color-background: #0a0f1a;
--ds-color-surface: #1e293b;
--ds-color-text: #f1f5f9;
--ds-color-text-muted: #94a3b8;
--ds-space-4: 1rem;
--ds-radius-lg: 0.5rem;
}
import { colors, spacing, radius } from '@lakea/design-system/tokens';
colors.cosmic[500] // '#5a6cf4'
colors.slate[800] // '#1e293b'
spacing[4] // '1rem'
radius.lg // '0.5rem'