# calangoui — AI First Design System > This document is the complete reference for the calangoui design system. Read it fully to understand all available components, tokens, and patterns. Always import from '@by2-ai/calangoui'. ## Quick Start ```bash npm install @by2-ai/calangoui styled-components recharts react-icons ``` ```tsx import { CalangoUIProvider } from '@by2-ai/calangoui'; function App() { return ( ); } ``` ### Peer Dependencies - `react` >= 18 - `react-dom` >= 18 - `styled-components` >= 6 - `recharts` (for charts) - `react-icons` (for icons) --- ## Design Tokens ### Colors ```ts import { colors } from '@by2-ai/calangoui'; // Base colors.black // '#000000' colors.white // '#FFFFFF' // Gray Scale (11 steps) colors.gray[50] // '#FAFAFA' colors.gray[100] // '#F4F4F5' colors.gray[200] // '#E4E4E7' colors.gray[300] // '#D4D4D8' colors.gray[400] // '#A1A1AA' colors.gray[500] // '#71717A' colors.gray[600] // '#52525B' colors.gray[700] // '#3F3F46' colors.gray[800] // '#27272A' colors.gray[900] // '#18181B' colors.gray[950] // '#09090B' // Semantic Colors (each has light, DEFAULT, dark) colors.success.light // '#4ADE80' colors.success.DEFAULT // '#22C55E' colors.success.dark // '#16A34A' colors.error.light // '#F87171' colors.error.DEFAULT // '#EF4444' colors.error.dark // '#DC2626' colors.warning.light // '#FBBF24' colors.warning.DEFAULT // '#F59E0B' colors.warning.dark // '#D97706' colors.info.light // '#60A5FA' colors.info.DEFAULT // '#3B82F6' colors.info.dark // '#2563EB' ``` ### Typography ```ts import { typography } from '@by2-ai/calangoui'; typography.fontFamily.sans // '"Geist Sans", "Inter", -apple-system, ...' typography.fontFamily.mono // '"Geist Mono", "Fira Code", ...' // Font Sizes typography.fontSize.xs // '0.75rem' typography.fontSize.sm // '0.875rem' typography.fontSize.base // '1rem' typography.fontSize.lg // '1.125rem' typography.fontSize.xl // '1.25rem' typography.fontSize['2xl'] // '1.5rem' typography.fontSize['3xl'] // '1.875rem' typography.fontSize['4xl'] // '2.25rem' // Font Weights typography.fontWeight.light // 300 typography.fontWeight.normal // 400 typography.fontWeight.medium // 500 typography.fontWeight.semibold // 600 typography.fontWeight.bold // 700 // Line Heights typography.lineHeight.tight // 1.25 typography.lineHeight.normal // 1.5 typography.lineHeight.relaxed // 1.75 ``` ### Spacing (base 4px) ```ts import { spacing } from '@by2-ai/calangoui'; spacing[0] // '0px' spacing[0.5] // '2px' spacing[1] // '4px' spacing[1.5] // '6px' spacing[2] // '8px' spacing[2.5] // '10px' spacing[3] // '12px' spacing[4] // '16px' spacing[5] // '20px' spacing[6] // '24px' spacing[8] // '32px' spacing[10] // '40px' spacing[12] // '48px' spacing[16] // '64px' spacing[20] // '80px' spacing[24] // '96px' ``` ### Border Radius ```ts import { radii } from '@by2-ai/calangoui'; radii.none // '0px' radii.sm // '4px' radii.md // '8px' radii.lg // '12px' radii.xl // '16px' radii['2xl'] // '24px' radii.full // '9999px' ``` ### Shadows ```ts import { shadows } from '@by2-ai/calangoui'; shadows.none // 'none' shadows.sm // '0 1px 2px rgba(0,0,0,0.4)' shadows.md // '0 4px 6px rgba(0,0,0,0.4)' shadows.lg // '0 10px 15px rgba(0,0,0,0.4)' shadows.xl // '0 20px 25px rgba(0,0,0,0.4)' shadows['2xl'] // '0 25px 50px rgba(0,0,0,0.5)' ``` ### Z-Index ```ts import { zIndex } from '@by2-ai/calangoui'; zIndex.base // 0 zIndex.dropdown // 1000 zIndex.sticky // 1100 zIndex.overlay // 1300 zIndex.modal // 1400 zIndex.popover // 1500 zIndex.toast // 1600 zIndex.tooltip // 1700 ``` --- ## Theme Engine ### CalangoUIProvider Wrap your app. Dark theme is the default. ```tsx import { CalangoUIProvider } from '@by2-ai/calangoui'; {/* dark by default */} {/* light mode */} {/* custom theme */} ``` ### useTheme Hook ```tsx import { useTheme } from '@by2-ai/calangoui'; const { theme, isDark, toggleTheme } = useTheme(); // Access semantic colors resolved by theme: theme.colors.background // dark: '#000000', light: '#FFFFFF' theme.colors.foreground // dark: '#FAFAFA', light: '#09090B' theme.colors.muted // dark: '#18181B', light: '#F4F4F5' theme.colors.mutedForeground // dark: '#A1A1AA', light: '#71717A' theme.colors.border // dark: '#27272A', light: '#E4E4E7' theme.colors.primary // dark: '#FFFFFF', light: '#000000' theme.colors.primaryForeground // dark: '#000000', light: '#FFFFFF' theme.colors.card // dark: '#09090B', light: '#FFFFFF' theme.colors.destructive // '#EF4444' theme.colors.accent // dark: '#27272A', light: '#F4F4F5' ``` ### createTheme ```tsx import { createTheme } from '@by2-ai/calangoui'; const myTheme = createTheme({ colors: { primary: '#FF0000', primaryForeground: '#FFFFFF' }, }); ``` ### GlobalStyles Automatically included in CalangoUIProvider. Applies CSS reset, font setup, and base styles. --- ## Primitive Components ### Box Polymorphic layout primitive. ```tsx import { Box } from '@by2-ai/calangoui'; content // Props: as, p, px, py, pt, pb, m, mx, my, bg, color, radius, shadow, border, w, h, minW, minH, maxW, display, overflow ``` ### Text ```tsx import { Text } from '@by2-ai/calangoui'; text long text that gets ellipsis... monospace text // Props: as, size, weight, color, align, truncate, mono, lineHeight ``` ### Heading ```tsx import { Heading } from '@by2-ai/calangoui'; Default h2 Big // Props: as, size, weight, color ``` ### Flex ```tsx import { Flex } from '@by2-ai/calangoui';
A
B
// Transient props (styled-components): $direction, $align, $justify, $wrap, $gap, $inline ``` ### Stack ```tsx import { Stack } from '@by2-ai/calangoui';
Item 1
Item 2
``` ### Grid ```tsx import { Grid } from '@by2-ai/calangoui'; ... ... // Props: $columns (number | string), $rows, $gap, $areas ``` ### Divider ```tsx import { Divider } from '@by2-ai/calangoui'; {/* horizontal */} {/* vertical */} ``` ### Icon ```tsx import { Icon } from '@by2-ai/calangoui'; ``` ### RoundedIcon Icon with styled background. ```tsx import { RoundedIcon, HiSparkles } from '@by2-ai/calangoui'; } variant="soft" size="lg" color={theme.colors.info.DEFAULT} /> } variant="solid" size="md" /> } variant="outline" size="xl" radius="md" /> // variant: 'solid' | 'soft' | 'outline' | 'ghost' // size: 'xs' | 'sm' | 'md' | 'lg' | 'xl' | '2xl' // radius: 'sm' | 'md' | 'lg' | 'full' // color: any CSS color string ``` --- ## Input Components ### Button ```tsx import { Button } from '@by2-ai/calangoui'; // variant: 'solid' | 'outline' | 'ghost' | 'link' // size: 'sm' | 'md' | 'lg' // Props: variant, size, loading, disabled, leftIcon, rightIcon ``` ### IconButton ```tsx import { IconButton } from '@by2-ai/calangoui'; ``` ### Input ```tsx import { Input, InputGroup, Label, ErrorText } from '@by2-ai/calangoui'; } /> Go} /> // size: 'sm' | 'md' | 'lg' // Props: size, error (string), leftElement, rightElement, disabled ``` ### Textarea ```tsx import { Textarea } from '@by2-ai/calangoui';