# Atoms Components Library **Status:** โœ… Phase 1 Implementation Complete **Created:** 2026-04-03 **Foundation:** Atomic Design Pattern --- ## ๐Ÿ“š Overview Atoms are the basic building blocks of your UI. They are small, focused, reusable components that have no dependencies on other components (except potentially other atoms). **Key Principles:** - โœ… No business logic - โœ… No context/hooks (useAuth, useCart, etc.) - โœ… Pure props-based - โœ… Full TypeScript typing - โœ… CSS variables for theming - โœ… Accessible by default --- ## ๐ŸŽฏ Atoms Created ### Buttons (`buttons/`) #### **Button.tsx** Main interactive button component with multiple variants and sizes. **Props:** - `variant` - "primary" | "secondary" | "danger" | "ghost" (default: "primary") - `size` - "sm" | "md" | "lg" (default: "md") - `icon` - FontAwesome icon class (optional) - `iconPosition` - "left" | "right" (default: "left") - `disabled` - boolean - `children` - ReactNode - `className` - string (for custom overrides) - All standard HTML button attributes **Usage:** ```tsx import { Button } from "@/components/atoms"; ``` **Styling:** - Primary: Branded color with dark hover - Secondary: Border style with light background on hover - Danger: Red for destructive actions - Ghost: Transparent with light background on hover --- #### **IconButton.tsx** Button designed specifically for icon-only interactions. **Props:** - `variant` - "primary" | "secondary" | "danger" | "ghost" - `size` - "sm" (8x8) | "md" (10x10) | "lg" (12x12) - `icon` - FontAwesome icon class (required) - All standard HTML button attributes **Usage:** ```tsx import { IconButton } from "@/components/atoms"; ``` --- ### Inputs (`inputs/`) #### **TextInput.tsx** General text input field with optional label, error, and icon. **Props:** - `label` - string (optional) - `error` - string (optional, shows red border and error text) - `icon` - FontAwesome icon class (optional) - `onIconClick` - callback when icon is clicked - All standard HTML input attributes **Usage:** ```tsx import { TextInput } from "@/components/atoms"; ``` --- #### **SearchInput.tsx** Search input with built-in search icon and clear button. **Props:** - `value` - string (controlled input) - `onChange` - callback when text changes - `onClear` - callback for clear button (required for button to show) - `placeholder` - string - All standard HTML input attributes **Usage:** ```tsx import { SearchInput } from "@/components/atoms"; const [query, setQuery] = useState(""); setQuery(e.target.value)} onClear={() => setQuery("")} placeholder="Search products..." />; ``` --- #### **Textarea.tsx** Multi-line text input with optional label and error. **Props:** - `label` - string (optional) - `error` - string (optional) - All standard HTML textarea attributes **Usage:** ```tsx import { Textarea } from "@/components/atoms";