# 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'; Primary Outline Ghost Link Small Medium Large Loading... Disabled }>With Icon // 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'; Email } /> Go} /> // size: 'sm' | 'md' | 'lg' // Props: size, error (string), leftElement, rightElement, disabled ``` ### Textarea ```tsx import { Textarea } from '@by2-ai/calangoui'; // Props: error (string), resize ('none' | 'vertical' | 'horizontal' | 'both') ``` ### Select (Radix) Compound component based on Radix Select. ```tsx import { Select } from '@by2-ai/calangoui'; ▾ Category Option A Option B Other Option C ``` ### Checkbox (Radix) ```tsx import { Checkbox } from '@by2-ai/calangoui'; ``` ### RadioGroup (Radix) ```tsx import { RadioGroup } from '@by2-ai/calangoui'; ``` ### Switch (Radix) ```tsx import { Switch } from '@by2-ai/calangoui'; // size: 'sm' | 'md' ``` ### Slider (Radix) ```tsx import { Slider } from '@by2-ai/calangoui'; {/* range mode */} ``` ### DatePicker Calendar popover component. ```tsx import { DatePicker } from '@by2-ai/calangoui'; ``` ### MaskedInput Input with preset masks for Brazilian formats. ```tsx import { MaskedInput } from '@by2-ai/calangoui'; {/* 000.000.000-00 */} {/* 00.000.000/0000-00 */} {/* (00) 00000-0000 */} {/* (00) 0000-0000 */} {/* 00000-000 */} {/* R$ 1.234,56 */} {/* 0000 0000 0000 0000 */} {/* DD/MM/AAAA */} {/* HH:MM */} // mask: 'cpf' | 'cnpj' | 'phone' | 'cellphone' | 'cep' | 'date' | 'time' | 'currency' | 'creditcard' | custom pattern // Custom: mask="99/99" where 9 = digit // onChange receives (event, rawValue) where rawValue has only digits ``` --- ## Feedback Components ### Badge ```tsx import { Badge } from '@by2-ai/calangoui'; Default Success Error Warning Info Outline Soft Small With dot // variant: 'solid' | 'outline' | 'soft' // colorScheme: 'success' | 'error' | 'warning' | 'info' | any theme color key // size: 'sm' | 'md' ``` ### Alert ```tsx import { Alert, AlertTitle } from '@by2-ai/calangoui'; Info Your account has been updated. ... {}}>... ... // variant: 'info' | 'success' | 'warning' | 'error' // closable: boolean, onClose: () => void, icon: ReactNode ``` ### Progress ```tsx import { Progress } from '@by2-ai/calangoui'; // size: 'sm' | 'md' | 'lg' // Props: value (0-100), size, indeterminate, color ``` ### Spinner ```tsx import { Spinner } from '@by2-ai/calangoui'; // $size: 'sm' (16px) | 'md' (24px) | 'lg' (32px) | 'xl' (48px) ``` ### Skeleton ```tsx import { Skeleton } from '@by2-ai/calangoui'; {/* circle */} ``` ### Toast (Radix) ```tsx import { Toast } from '@by2-ai/calangoui'; Saved Changes saved successfully. Undo // $variant: 'default' | 'success' | 'error' | 'warning' | 'info' ``` --- ## Overlay Components ### Dialog (Radix) ```tsx import { Dialog, Button } from '@by2-ai/calangoui'; Open Title Description text. Cancel Confirm ``` ### AlertDialog (Radix) Same as Dialog but backdrop click does NOT close it. ```tsx import { AlertDialog, Button } from '@by2-ai/calangoui'; Delete Are you sure? This cannot be undone. Cancel Delete ``` ### Drawer (Radix) Slides in from a side. ```tsx import { Dialog, Drawer, Button } from '@by2-ai/calangoui'; Open Drawer {/* 'left' | 'right' | 'top' | 'bottom' */} Settings Content here Close ``` ### Popover (Radix) ```tsx import { Popover, Button } from '@by2-ai/calangoui'; Open Content ``` ### Tooltip (Radix) ```tsx import { Tooltip, Button } from '@by2-ai/calangoui'; Hover me Tooltip text ``` ### DropdownMenu (Radix) ```tsx import { DropdownMenu, Button } from '@by2-ai/calangoui'; Actions ▾ Actions Edit Duplicate Delete More Archive ``` ### ContextMenu (Radix) ```tsx import { ContextMenu } from '@by2-ai/calangoui'; Right-click this area Cut Copy Paste ``` --- ## Navigation Components ### Tabs (Radix) ```tsx import { Tabs } from '@by2-ai/calangoui'; Tab 1 Tab 2 Content 1 Content 2 ``` ### Sidebar ```tsx import { Sidebar } from '@by2-ai/calangoui'; App Name SECTION Dashboard Settings Footer ``` ### Breadcrumb ```tsx import { Breadcrumb } from '@by2-ai/calangoui'; Home / Products / Details ``` ### Pagination ```tsx import { Pagination } from '@by2-ai/calangoui'; ``` ### NavigationMenu (Radix) ```tsx import { NavigationMenu } from '@by2-ai/calangoui'; Products Mega menu content About ``` --- ## Data Display Components ### Table ```tsx import { Table } from '@by2-ai/calangoui'; Name Status Alice Active Total: 1 ``` ### Card ```tsx import { Card, Button } from '@by2-ai/calangoui'; {/* 'elevated' | 'outline' | 'filled' */} Title Description Content here Action {/* hover lift effect */} ``` ### Avatar (Radix) ```tsx import { Avatar } from '@by2-ai/calangoui'; {/* size: xs|sm|md|lg|xl, shape: circle|square */} JD ``` ### Accordion (Radix) ```tsx import { Accordion } from '@by2-ai/calangoui'; Question 1? Answer here. // type: 'single' | 'multiple' ``` ### Tag ```tsx import { Tag } from '@by2-ai/calangoui'; Default Success Error {}}>Removable // variant: 'solid' | 'outline' | 'soft' // colorScheme: 'success' | 'error' | 'warning' | 'info' ``` --- ## Charts (Recharts-based) All charts auto-theme with calangoui. Requires `recharts` as peer dependency. ### BarChart ```tsx import { BarChart } from '@by2-ai/calangoui'; // Props: data, height, color, colors, horizontal, showGrid, showTooltip, showLegend, radius, dataKeys ``` ### LineChart ```tsx import { LineChart } from '@by2-ai/calangoui'; // Props: data, height, color, showGrid, showDots, showTooltip, curved, strokeWidth, dataKeys ``` ### AreaChart ```tsx import { AreaChart } from '@by2-ai/calangoui'; // Props: data, height, color, showGrid, showTooltip, stacked, dataKeys ``` ### DonutChart / PieChart ```tsx import { DonutChart } from '@by2-ai/calangoui'; {/* pie chart */} // Props: data, height, donut, innerRadius, showTooltip, showLegend, showLabels ``` ### RadarChart ```tsx import { RadarChart } from '@by2-ai/calangoui'; ``` ### RadialBarChart ```tsx import { RadialBarChart } from '@by2-ai/calangoui'; ``` ### SparkLine Inline mini chart for tables and cards. ```tsx import { SparkLine } from '@by2-ai/calangoui'; ``` ### StatCard KPI card with trend and sparkline. ```tsx import { StatCard, HiCurrencyDollar } from '@by2-ai/calangoui'; } /> ``` --- ## Advanced Components ### CommandPalette ```tsx import { CommandPalette } from '@by2-ai/calangoui'; {} }, { label: 'Settings', shortcut: '⌘,' }, ], }, ]} placeholder="Type a command..." /> // Automatically opens with Cmd+K / Ctrl+K ``` ### Stepper ```tsx import { Stepper } from '@by2-ai/calangoui'; // orientation: 'horizontal' | 'vertical' // step.status: 'complete' | 'active' | 'pending' | 'error' ``` ### Collapsible (Radix) ```tsx import { Collapsible, Button } from '@by2-ai/calangoui'; Toggle Hidden content with animated expand/collapse. ``` ### HoverCard (Radix) ```tsx import { HoverCard } from '@by2-ai/calangoui'; @username User profile card content ``` ### ScrollArea (Radix) ```tsx import { ScrollArea } from '@by2-ai/calangoui'; {/* scrollable content */} ``` ### AspectRatio (Radix) ```tsx import { AspectRatio } from '@by2-ai/calangoui'; ``` ### Separator (Radix) ```tsx import { Separator } from '@by2-ai/calangoui'; ``` --- ## Icons 200+ curated icons from `react-icons`, re-exported from calangoui. Requires `react-icons` as peer dependency. ### Usage ```tsx import { HiSparkles, HiCheck, FiGithub, SiReact } from '@by2-ai/calangoui'; ``` ### Categories | Prefix | Source | Examples | |--------|--------|---------| | `Hi*` | Heroicons 2 | HiArrowRight, HiCheck, HiPlus, HiXMark, HiMagnifyingGlass, HiBell, HiUser, HiCog6Tooth, HiHome, HiHeart, HiStar | | `Fi*` | Feather Icons | FiGithub, FiTwitter, FiLinkedin, FiTerminal, FiPackage, FiLayers, FiZap, FiActivity | | `Si*` | Simple Icons | SiReact, SiTypescript, SiNextdotjs, SiVite, SiDocker, SiFirebase, SiStripe, SiOpenai, SiAnthropic | ### With RoundedIcon ```tsx import { RoundedIcon, HiCheckCircle } from '@by2-ai/calangoui'; } variant="soft" color="#22C55E" size="lg" /> ``` --- ## Common Patterns ### Form with validation ```tsx Name CPF Phone Submit ``` ### Dashboard layout ```tsx App Dashboard Settings ``` ### Data table with tags ```tsx Name Status {data.map(row => ( {row.name} {row.active ? 'Active' : 'Inactive'} ))} ``` --- ## TypeScript All components are fully typed. Key types: ```ts import type { CalangoUITheme, SemanticColors, CalangoUIProviderProps, ButtonProps, ButtonVariant, ButtonSize, InputProps, TextareaProps, MaskedInputProps, MaskPreset, BadgeProps, AlertProps, ProgressProps, SpinnerProps, SkeletonProps, TagProps, CardVariant, AvatarSize, PaginationProps, BarChartProps, LineChartProps, AreaChartProps, DonutChartProps, RadarChartProps, StatCardProps, SparkLineProps, ChartDataPoint, CommandPaletteProps, StepperProps, StepItem, StepStatus, RoundedIconProps, RoundedIconSize, RoundedIconVariant, DatePickerProps, } from '@by2-ai/calangoui'; ``` --- *calangoui v0.1.0 — AI First Design System* *Built with styled-components, Radix UI, Recharts, and TypeScript.*
Content here
Content
Mega menu content
User profile card content