Introduction
MicroCBM provides a comprehensive component library designed for building modern, accessible, and maintainable condition-based maintenance interfaces. The library is built on top of React 18, Next.js 15, and leverages Radix UI primitives for accessibility.Architecture
The component library is organized into three main categories:- UI Components - Core building blocks like buttons, inputs, selects, and modals
- Data Visualization - Charts and graphs for displaying metrics and trends
- Form Inputs - Specialized form components for data entry and validation
Design System
All components follow a consistent design system with:- Tailwind CSS for styling and utility classes
- Class Variance Authority (CVA) for component variants
- Radix UI primitives for accessibility and keyboard navigation
- Framer Motion for animations and transitions
- Iconify for consistent iconography
Component Location
All components are located in/src/components/ and follow this structure:
Import Patterns
Components can be imported directly from the@/components barrel export:
Common Props
Most components share common prop patterns:Additional CSS classes to apply to the component
Error state and message for form components
Disables user interaction with the component
Label text for form inputs
Accessibility
All components are built with accessibility in mind:- Keyboard Navigation - Full keyboard support for all interactive elements
- Screen Reader Support - Proper ARIA attributes and semantic HTML
- Focus Management - Visible focus indicators and logical focus order
- Color Contrast - WCAG AA compliant color combinations
TypeScript Support
All components are fully typed with TypeScript interfaces and types exported for use in your application:Styling Approach
Components use a hybrid styling approach:- Tailwind Utility Classes - For most styling needs
- CSS Modules - For component-specific styles (e.g.,
Input.module.scss,Table.module.scss) - CVA - For managing component variants and states
The
cn() utility from @/libs is used throughout for conditional class merging using clsx and tailwind-merge.Component Categories
UI Components
Core interface elements for building application UIs:- Button, Input, Select, Modal
- Table, Checkbox, Radio
- StatusBadge, Tag, Label
- Dialog, Popover, Sheet
Data Visualization
Chart components for displaying metrics and analytics:- AreaChart - Time series data with filled areas
- BarChart - Comparative data visualization
- PieChart - Proportional data display
Form Inputs
Specialized inputs for forms and data entry:- PhoneInput - International phone number input
- FileUploader - File upload with preview
- DateInput - Date and date range selection
- OTPInput - One-time password entry
Best Practices
Component Composition
Compose complex UIs from smaller, reusable components:Error Handling
Use theerror prop consistently across form components:
Loading States
Indicate loading states with theloading prop on buttons:
Next Steps
Explore the detailed documentation for each component category:- UI Components - Buttons, inputs, modals, and more
- Data Visualization - Charts and graphs
- Form Inputs - Specialized form components