ADR-003: Use Chakra UI for Component Library
Date: 2025-10-06 Status: Accepted Deciders: Development Team Tags: ui, components, styling
Context​
Need a component library that provides:
- Professional, accessible components
- Dark/light theme support
- VS Code-like aesthetics
- TypeScript support
- Customizable styling
Decision​
Use Chakra UI 2.8 as the primary component library.
Rationale​
Why Chakra UI​
- Accessibility: WCAG compliant out of the box
- Theme System: Built-in dark/light mode
- TypeScript: Full TypeScript support
- Composition: Component composition pattern
- Customization: Easy to override styles
- No CSS: Style props, no separate CSS files
- Performance: Only loads used components
Key Features​
- Color mode management (dark/light)
- Responsive design system
- Semantic HTML components
- Focus management
- Keyboard navigation
Alternatives Considered​
Material-UI (MUI)​
- Pros: Most popular, comprehensive
- Cons: Larger bundle, Material Design aesthetic
- Rejected: Too opinionated, heavier
Ant Design​
- Pros: Enterprise-ready, many components
- Cons: Chinese-centric, large bundle
- Rejected: Not suitable for VS Code aesthetic
Tailwind CSS + Headless UI​
- Pros: Full control, small bundle
- Cons: More manual work, utility class verbosity
- Rejected: Need ready components, not utilities
Radix UI​
- Pros: Unstyled, accessible, composable
- Cons: Need to style everything manually
- Rejected: Too much styling work needed
Consequences​
Positive​
- Fast UI development with ready components
- Consistent dark/light themes
- Built-in accessibility
- Good documentation
- Active community
Negative​
- Learning curve for Chakra's API
- Bundle size larger than CSS-only solutions
- Some custom styling still needed for VS Code look
Implementation​
Theme Configuration​
// chakra-theme.ts
import { extendTheme } from '@chakra-ui/react';
const theme = extendTheme({
config: {
initialColorMode: 'dark',
useSystemColorMode: false,
},
colors: {
brand: {
500: '#2196f3',
// ...
},
},
semanticTokens: {
colors: {
'editor.bg': {
default: '#1e1e1e',
_light: '#ffffff',
},
'editor.sidebar': {
default: '#252526',
_light: '#f5f5f5',
},
},
},
});
Component Usage​
<Flex h="100vh" bg="editor.bg">
<Box bg="editor.sidebar" w="250px">
<Heading size="sm">FILES</Heading>
<VStack>
<Button variant="ghost">file.ts</Button>
</VStack>
</Box>
</Flex>
VS Code-like Styling​
Custom semantic tokens for VS Code theme:
editor.bg: Main backgroundeditor.sidebar: Sidebar backgroundeditor.border: Border colorseditor.text: Text colors