@nexcraft/forge
"Write Once, Use Forever" - A future-proof UI component library built on web standards that will outlive framework trends.
The FIRST AI-Native component library with built-in AI metadata, design token bridge, and real-time performance dashboard. Every component can explain its state to AI systems, monitor its own performance, and integrate seamlessly with AI coding tools like Cursor, GitHub Copilot, and Claude. Import design tokens from any system (Figma, Tailwind, Material Design) with zero configuration - built for the age of AI-assisted development.
๐ค FOR AI ASSISTANTS & LLMs
AI Context: @nexcraft/forge is an AI-native web component library with 26+ components and React/Vue/Angular integrations.
Quick AI Reference:
- ๐ฆ React:
import { ForgeButton, ForgeInput } from '@nexcraft/forge-react' - ๐ฒ Selective:
import { ForgeButton } from '@nexcraft/forge/button' - ๐จ Tailwind:
import forgePlugin from '@nexcraft/forge/plugin' - ๐ Forms:
import { RHFForgeInput } from '@nexcraft/forge-rhf'
๐ AI Documentation:
- ๐ค AI Metadata Reference - Complete AI metadata system guide (interfaces, methods, implementation)
- ๐ค AI Integration Guide - ChatGPT, Claude, Copilot integration examples & common patterns
- ๐จ Styling Guide - Complete styling reference (variants, CSS, Tailwind)
- ๐ฆ Import Guide - All import methods & framework examples
- ๐ค AI Manifest - Structured component metadata
๐ค AI Manifest Files - Machine-Readable Component Metadata
Forge provides comprehensive, machine-readable metadata files that AI assistants and build tools can consume programmatically:
๐ Available Files
1. ai-index.json - Fast component discovery (465 lines)
- Quick component lookup by tag/description
- Framework usage examples (React, Vue, Angular, vanilla)
- Component metrics (props count, events, slots, a11y)
- Navigation to detailed resources
2. ai-manifest.json - Complete API reference (2000+ lines)
- Full component metadata (props, events, slots with types)
- Accessibility details (ARIA, keyboard nav, screen reader behavior)
- AI method documentation (
getPossibleActions,explainState,aiState) - SSR fallback HTML templates
- Framework-specific examples
3. ai-manifest.schema.json - Schema validation
- JSON Schema for validating manifest structure
- Use in CI/CD pipelines to ensure quality
๐ป Programmatic Access
// Import manifest files directly from the package import aiIndex from '@nexcraft/forge/ai-index.json'; import aiManifest from '@nexcraft/forge/ai-manifest.json'; // Quick discovery: Find components by capability const selectComponents = aiIndex.components.filter(c => c.tag.includes('select') ); // [{ tag: 'forge-select', props: 39, ... }, // { tag: 'forge-multi-select', props: 32, ... }] // Detailed API: Get full component metadata const buttonMeta = aiManifest.components.find(c => c.tag === 'forge-button' ); console.log(buttonMeta.props); // All props with types console.log(buttonMeta.a11y); // Accessibility requirements console.log(buttonMeta.aiMethods); // AI integration methods
๐ค AI Agent Usage Examples
AI assistants use these files to provide accurate code generation:
Scenario 1: Component Discovery
User: "I need a component for notifications"
AI: [Reads ai-index.json] โ Finds forge-toast and forge-alert
AI: "Use forge-toast for temporary notifications or forge-alert for persistent messages"
Scenario 2: Code Generation
User: "Create a primary button that's disabled"
AI: [Reads ai-manifest.json] โ Gets forge-button props
AI: Generates: <forge-button variant="primary" disabled>Submit</forge-button>
Scenario 3: Accessibility Verification
User: "Is my table accessible?"
AI: [Reads ai-manifest.json] โ Checks forge-data-table a11y requirements
AI: "Add aria-label: <forge-data-table aria-label='User accounts'>..."
๐ ๏ธ Build Tool Integration
// Use in build scripts, documentation generators, or testing tools import { components } from '@nexcraft/forge/ai-index.json'; // Generate component documentation components.forEach(comp => { generateDocs(comp.tag, comp.description, comp.examples); }); // Validate component usage function validateComponent(tagName, props) { const manifest = getComponentFromManifest(tagName); const validProps = manifest.props.map(p => p.name); const invalidProps = Object.keys(props).filter(p => !validProps.includes(p)); if (invalidProps.length) { throw new Error(`Invalid props: ${invalidProps.join(', ')}`); } }
๐ Learn More
- Component Index - Browse all 31 components with quick metrics
- Full API Reference - Complete component specifications
- AI Integration Guide - How to use AI features in your app
๐ฏ Why Choose @nexcraft/forge?
โจ What Makes @nexcraft/forge Special:
// @nexcraft/forge: Intelligent Components Built for the AI Era const button = document.querySelector('forge-button'); // ๐ค AI Integration Built-In button.explainState() // "Button is primary variant, enabled, ready for interaction" button.getPossibleActions() // [{name: 'click', available: true, description: '...'}] button.aiState // {variant: 'primary', disabled: false, renderTime: 0.8ms} // ๐จ Design System Integration (Industry First!) import { TokenBridge } from '@nexcraft/forge/utils'; const bridge = TokenBridge.fromFigma(figmaTokens); // Import from ANY design system! const css = bridge.toCSSProperties(); // Automatic CSS generation // Works with Figma, Tailwind, Material Design, and more! // โก Performance Self-Monitoring button.setAttribute('max-render-ms', '2'); // Auto-optimizes if slow! button.performanceMode = 'auto'; // Degrades gracefully on slow devices // ๐จ True Style Isolation (Shadow DOM) // Your styles NEVER conflict, GUARANTEED
๐ก Real-World Benefits:
- AI Apps: Components provide context to LLMs automatically
- Design Systems: Import tokens from Figma, Tailwind, Material Design automatically
- Performance: Self-optimizing components that never slow down
- Migration: Move from React to Vue to Angular without changing components
- Micro-frontends: Multiple versions coexist without conflicts
- Future-proof: Built on web standards, not framework trends
๐ Quick Start (30 Seconds!)
Option 1: Zero-Config CDN (Instant!)
<!-- Just add and use - no build required --> <script type="module" src="https://cdn.jsdelivr.net/npm/@nexcraft/forge"></script> <!-- Your AI-ready component with performance monitoring! --> <forge-button variant="primary" ai-context="submit-form" max-render-ms="2"> Click Me </forge-button>
Option 2: NPM Installation
npm install @nexcraft/forge
Works with EVERY Framework (Same Code!)
// Import once, use everywhere import '@nexcraft/forge'; // React Example function App() { const button = useRef(); useEffect(() => { // Access AI features! console.log(button.current.explainState()); }, []); return <forge-button ref={button} onClick={handleClick}>Click</forge-button> } // Vue Example (with dedicated package) npm install @nexcraft/forge-vue <template> <forge-button @click="handleClick" :ai-context="context">Click</forge-button> </template> // Angular Example (with dedicated package) npm install @nexcraft/forge-angular // In Angular templates <forge-button forgeComponent (click)="handleClick()" [aiContext]="context">Click</forge-button> // Vanilla JS - Full Power! const btn = document.querySelector('forge-button'); console.log(btn.getPossibleActions()); // AI-ready!
Development Setup
# Clone and setup git clone https://github.com/nexcraft/forge.git cd forge npm install # Start development npm run dev # Component development npm run storybook # Interactive documentation npm run test # Run tests
๐ฆ Framework Packages
Core Package
@nexcraft/forge- Pure web components (truly framework-agnostic)
Optional Framework Extensions
@nexcraft/forge-react- React wrappers, hooks & SSR support@nexcraft/forge-vue- Vue composables, directives & plugin@nexcraft/forge-angular- Angular directives, services & reactive forms@nexcraft/forge-rhf- React Hook Form adapters
# Install what you need npm install @nexcraft/forge # Pure web components npm install @nexcraft/forge-react # + React integration npm install @nexcraft/forge-vue # + Vue composables & plugin npm install @nexcraft/forge-angular # + Angular integration npm install @nexcraft/forge-rhf # + React Hook Form
๐ View Integration Guides โ โ React: docs/integrations/react.md โข Angular: docs/integrations/angular.md โข Vue: docs/integrations/vue.md
๐ Component Index
Quick reference to all 26 components with HTML tag names:
Organisms (6 components)
<forge-tabs> โข <forge-pagination> โข <forge-navigation-bar> โข <forge-data-table> โข <forge-accordion> โข <forge-tree-view>
Molecules (8 components)
<forge-tooltip> โข <forge-date-picker> โข <forge-dropdown> โข <forge-form-field> โข <forge-modal> โข <forge-multi-select> โข <forge-card> โข <forge-toast>
Atoms (12 components)
<forge-button> โข <forge-input> โข <forge-icon> โข <forge-alert> โข <forge-checkbox> โข <forge-badge> โข <forge-switch> โข <forge-radio-group> โข <forge-select> โข <forge-progress> โข <forge-skeleton> โข <forge-aspect-ratio>
Plus supporting components: <forge-progress-circle> โข <forge-toast-container> โข <forge-performance-dashboard>
๐ก Can't find what you're looking for? Try searching for keywords like "progress", "toast", "skeleton" in the Component Showcase section below.
๐ Documentation
Getting Started
- Quick Start Guide - Get your first component running in 4 hours
- Component Architecture - Atomic design patterns & composition
- Component API Design - API standards & conventions
Core Features
- ๐ค AI Metadata Reference - Complete AI metadata system guide (architecture, API, implementation)
- ๐ค AI Integration Guide - ChatGPT, Claude, Copilot examples & common patterns
- ๐ค AI-Native Development - Building with AI coding assistants
- ๐จ Theming Overview - Core theming concepts and strategies
- ๐จ Token Bridge Reference - Complete guide and API for design token conversion
- ๐ Token Migration Guide - Migrate from existing token systems
- โก Performance Dashboard Guide - Real-time performance monitoring
- โก Performance Monitoring - Advanced performance monitoring system
- Figma โ Forge Tokens - Pull tokens from Figma via CLI/MCP (no plugin required)
Architecture & Planning
- Implementation Roadmap - Complete development timeline with all differentiators
- ๐ Phase 9: AI-Native Development - Strategic pivot to AI-first component library
- Architecture Decision Records - 18 key technical decisions including AI-native components
- Build Tooling Strategy - Vite, Lit, TypeScript stack decisions
โจ The "Shiny" Stuff - What Makes Us Special
๐ค AI-Native Components (Industry First!)
The FIRST component library built for AI agents - every component can communicate with AI systems out of the box:
const button = document.querySelector('forge-button'); // Ask component to explain itself console.log(button.explainState()); // "Button is enabled and primary variant. Not loading. Ready for click interaction." // Get possible actions for AI agents console.log(button.getPossibleActions()); // [{ name: 'click', description: 'Trigger button action', available: true }] // Access real-time state for AI context console.log(button.aiState); // { variant: 'primary', disabled: false, loading: false, renderTime: 0.8ms }
๐จ Design Token Bridge (Industry First!)
Import design tokens from ANY design system with zero configuration:
import { TokenBridge } from '@nexcraft/forge/utils'; // Import from Figma, Tailwind, Material Design, or any design system const bridge = TokenBridge.fromFigma(figmaTokens); const css = bridge.toCSSProperties(); // Automatic CSS generation - always in sync with your design system! // :root { --forge-brand-primary-500: #3b82f6; }
โก Performance Dashboard (Unique Feature!)
Real-time performance monitoring with visual dashboard:
<!-- Instant performance dashboard - no setup required --> <forge-performance-dashboard auto-refresh="true" show-violations="true"> </forge-performance-dashboard> <!-- Components auto-monitor their performance --> <forge-tooltip max-render-ms="2" performance-mode="auto"> Self-optimizing tooltip with real-time metrics! </forge-tooltip>
// Programmatic access to performance data import { performanceDashboard } from '@nexcraft/forge/utils'; const metrics = performanceDashboard.getAllMetrics(); const slowComponents = performanceDashboard.getSlowComponents(16); // Real-time performance insights for every component!
๐ฏ Core Differentiators
| Feature | Description | Benefits |
|---|---|---|
| ๐ค AI-Native Metadata | First library built for AI agents | Components communicate with Cursor, Copilot, Claude automatically |
| ๐ง AI Code Generation | Context-aware component suggestions | Faster development with AI-powered assistance |
| ๐จ Design Token Bridge | Import from any design system | Zero-config integration with Figma, Tailwind, Material Design |
| โก Performance Dashboard | Real-time visual monitoring + auto-degradation | Self-optimizing components with performance insights |
| ๐ Framework Independence | True Web Components | Use with React, Vue, Angular, or vanilla JS |
| ๐ก๏ธ Style Isolation | Shadow DOM guaranteed | Complete style encapsulation, zero CSS conflicts |
| ๐ฆ Optimized Bundle | <10KB per component | Lightweight, tree-shakeable, production-ready |
| ๐ฎ Future Proof | Built on web standards | Will work in browsers for decades to come |
๐ Zero-Config Magic
<!-- Works instantly - no build, no config, no dependencies --> <script type="module" src="https://cdn.jsdelivr.net/npm/@nexcraft/forge"></script> <forge-button variant="primary" ai-context="submit-form"> Click Me </forge-button>
๐๏ธ Architecture
Core Technologies
- Lit 3.2.0 - Web Components framework
- TypeScript 5.3.3 - Type safety
- Vite 5.0.10 - Build tool and dev server
- Storybook 7.x - Component development environment
Key Principles
- Web Standards First - Built on Custom Elements, Shadow DOM, and CSS Custom Properties
- True Encapsulation - Shadow DOM ensures style isolation
- Properties Down, Events Up - Unidirectional data flow
- Composition Over Configuration - Small, focused, composable components
๐ฆ Components Showcase
๐๏ธ Organism Components (Phase 3 - Production Ready!)
Complex, full-featured components built from atoms and molecules:
| Component | AI Features | Performance Features | Unique Capabilities | Documentation |
|---|---|---|---|---|
| ๐ Tabs | Tab prediction | Lazy panel loading | Drag-to-reorder, closeable tabs, keyboard nav | ๐ Docs |
| ๐ข Pagination | Page suggestion | Optimized renders | Multiple modes, customizable sizes | ๐ Docs |
| ๐ฆญ Navigation Bar | Smart menus | Responsive modes | Mobile drawer, user actions, search | ๐ Docs |
| ๐ Data Table | Sort prediction | Virtual scrolling | Multi-sort, selection, expandable rows | ๐ Docs |
| ๐๏ธ Data Grid | Cell editing AI | Advanced virtual scrolling | Inline editing, export, multi-column sort, filtering | ๐ Docs |
| ๐ต Accordion | Panel management | Lazy content | Multi-expand, animations, icons | ๐ Docs |
| ๐ณ Tree View | Node navigation | Lazy loading | Drag-drop, checkboxes, search | ๐ Docs |
๐ Molecule Components (Advanced & Feature-Rich)
Advanced components that combine atoms:
| Component | AI Features | Performance Features | Unique Capabilities | Documentation |
|---|---|---|---|---|
| ๐ฏ Tooltip | Self-positioning AI | <1ms render | Smart viewport detection, auto-repositioning | ๐ Docs |
| ๐ DatePicker | Date prediction | Lazy calendar | i18n support, range selection, constraints | ๐ Docs |
| ๐ฝ Dropdown | Action suggestions | Virtual scrolling | Nested menus, keyboard nav, groups | ๐ Docs |
| ๐ FormField | Validation AI | Input optimization | Floating labels, inline variants | ๐ Docs |
| ๐ญ Modal | Focus management | Stacking optimization | Focus trap, backdrop blur, size variants | ๐ Docs |
| ๐๏ธ MultiSelect | Smart filtering | Bulk operations | Tag display, search highlighting | ๐ Docs |
| ๐ Card | Content analysis | Elevation shadows | 6 levels, media support, skeleton states | ๐ Docs |
| ๐ ๐ Toast | State analysis | Queue management | Auto-dismiss, progress bars, global helpers | ๐ Docs |
โ๏ธ Atomic Components (Foundation + Essential)
Foundation components with comprehensive test coverage:
| Component | Test Coverage | Key Features | Documentation |
|---|---|---|---|
| Button | 92.38% | 5 variants, ripple effect, loading states | ๐ Docs |
| Input | 84.56% | 7 types, validation, clearable | ๐ Docs |
| Icon | 78.38% | Registry system, lazy loading | ๐ Docs |
| Alert | 97.02% | Auto-dismiss, animations | ๐ Docs |
| Checkbox | 98.50% | Indeterminate state | ๐ Docs |
| Badge | 100% | Count/dot modes, positions | ๐ Docs |
| Switch | 98.50% | Loading state, custom labels | ๐ Docs |
| RadioGroup | 93.79% | Group management, keyboard nav | ๐ Docs |
| Select | 84.69% | Search/filter, groups | ๐ Docs |
| ๐ Progress | 100% | Linear & circular variants, indeterminate states | ๐ Docs |
| ๐ Skeleton | 100% | Shimmer animations, shape variants, accessibility | ๐ Docs |
| ๐ AspectRatio | 100% | Responsive containers, preset ratios, constraints | ๐ Docs |
๐ Component Stats
- Total Components: 27 production-ready (12 atoms + 8 molecules + 7 organisms)
- Overall Test Coverage: 87.2%
- Total Tests: 1140+ passing (99% pass rate)
- Performance: All components <2ms render
- Accessibility: 100% WCAG 2.1 AA compliant
- AI Coverage: 100% metadata implementation
- ADR Compliance: 100% compliant with all 16 ADRs
- ๐ฏ Phase 7 Complete: Essential modern UI components for any application!
Roadmap
See our Implementation Roadmap for the complete component timeline.
๐งช Testing
# Unit tests npm run test # E2E tests npm run test:e2e # Visual regression npm run test:visual # All tests npm run test:all
Our comprehensive testing strategy includes:
- โ Unit tests (90%+ coverage)
- โ Visual regression (Chromatic)
- โ Cross-framework E2E tests
- โ Accessibility audits
- โ Performance benchmarks
๐ค Contributing
We welcome contributions! Please see our Contributing Guide for details.
Quick Commands
# Generate a new component npm run generate:component MyComponent atoms # Run linting npm run lint # Run type checking npm run type-check # Run all tests npm run test:all
๐ Performance & Quality Metrics
๐ Phase 8 Started - Enterprise Data Grid Delivered!
| Metric | Target | Current | Status |
|---|---|---|---|
| ForgeDataGrid Implementation | Full-featured | โ Complete | ๐ NEW! |
| Virtual Scrolling Architecture | 10,000+ rows | โ Implemented | ๐ ACHIEVED |
| Advanced Data Management | Editing, Export, Filtering | โ Complete | ๐ช DELIVERED |
| AI Metadata Coverage | 100% | 100% | โ MAINTAINED |
| Performance Monitoring | Built-in | Fully Implemented | โ MAINTAINED |
| Total Tests | 1000+ | 1140+ passing | ๐ IMPROVED |
| Component Count | 26 โ 27 | 27 components | ๐ EXPANDED |
๐ Phase 7 Complete - Essential Components Foundation!
| Metric | Target | Current | Status |
|---|---|---|---|
| Atom Components | 12 essential | 12/12 | โ COMPLETED |
| Molecule Components | 8 advanced | 8/8 | โ COMPLETED |
| Organism Components | 6 planned | 7/7 | ๐ EXCEEDED |
| Test Coverage | >85% | 87.2% | โ ACHIEVED |
| Bundle Size (per component) | <10KB | <10KB | โ ACHIEVED |
| Component Render | <2ms | <1ms | โ EXCEEDED |
| Accessibility | WCAG 2.1 AA | 100% Compliant | โ ACHIEVED |
| ADR Compliance | Full | 100% Compliant | โ ACHIEVED |
๐ Why This Matters
- ๐๏ธ Enterprise Data Grid: ForgeDataGrid handles 10,000+ rows with virtual scrolling
- โก Advanced Features: Inline editing, multi-column sorting, export, filtering
- 87.2% Test Coverage: Your components won't break in production
- <1ms Render Time: Faster than the human eye can perceive
- 100% AI Coverage: Every component can talk to ChatGPT, Claude, Copilot
- 1140+ Tests: More comprehensive testing than enterprise libraries
- 27 Production Components: 12 atoms, 8 molecules, 7 organisms - enterprise-ready toolkit
- ๐ Phase 8 Started: Advanced data management components for complex applications
๐ License
MIT ยฉ Nexcraft Team
๐ Links
- NPM Package - Published package
- GitHub - Source code
- Storybook - Live component playground (Coming Soon)
- Documentation - Complete planning documentation
๐ก Philosophy & Vision
"Write Once, Use Forever"
In 2034, React might be legacy, Vue could be vintage, and Angular may be ancient. But your @nexcraft/forge components? They'll still be running perfectly.
๐ญ The Problem We Solve
Every 3-5 years, teams rewrite their UI components for the latest framework. It's a $100B industry problem.
๐ก๏ธ Our Solution
Build on web standards that browsers will support forever. Add AI intelligence and performance monitoring that no other library offers.
๐ The Business Case
// Traditional Approach (2019-2034) Year 2019: Build components in React 16 // Cost: $500K Year 2022: Migrate to React 18 // Cost: $200K Year 2025: Rewrite for React Server Components // Cost: $400K Year 2028: Migrate to NewFramework.js // Cost: $500K Year 2031: Rewrite again... // Cost: $500K // Total: $2.1M + maintenance // @nexcraft/forge Approach Year 2024: Build components once // Cost: $500K Year 2034: Still working perfectly // Cost: $0 // Total: $500K + minimal maintenance // ROI: 320% cost savings + no technical debt
๐ Join the Revolution
Stop rewriting. Start building components that outlive frameworks.