You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// Prefer React integrations for better TypeScript support and SSRimport{ForgeButton,ForgeInput,ForgeCard}from'@nexcraft/forge/integrations/react'// For forms with validationimport{RHFForgeInput,RHFForgeSelect}from'@nexcraft/forge/integrations/rhf'
Tree-shaking / Bundle Optimization
// Use selective imports for smaller bundlesimport{ForgeButton}from'@nexcraft/forge/button'import{ForgeInput}from'@nexcraft/forge/input'import{ForgeCard}from'@nexcraft/forge/card'
Tailwind CSS Projects
// Add Tailwind plugin for semantic utilitiesimportforgePluginfrom'@nexcraft/forge/plugin'// tailwind.config.jsexportdefault{plugins: [forgePlugin]}
import{useForm}from'react-hook-form'import{RHFForgeInput,RHFForgeSelect}from'@nexcraft/forge/integrations/rhf'functionUserForm(){const{ control, handleSubmit }=useForm()return(<formonSubmit={handleSubmit(onSubmit)}><RHFForgeInputname="email"label="Email"control={control}rules={{required: 'Email is required'}}/><RHFForgeSelectname="role"label="Role"control={control}options={roleOptions}/></form>)}
Next.js SSR
// Components work with SSR out of the boximport{ForgeCard,ForgeButton}from'@nexcraft/forge/integrations/react'exportdefaultfunctionPage(){return(<ForgeCard><divclassName="p-6"><h1>SSR Compatible</h1><ForgeButtonvariant="primary">Click me</ForgeButton></div></ForgeCard>)}
Common Use Cases
Authentication Forms
Use ForgeInput with type="email" and type="password"
Wrap in ForgeCard for container
Use ForgeButton with variant="primary" for submit
Add ForgeAlert for error messages
Dashboards
Use ForgeCard for metric containers
Use ForgeBadge for status indicators
Use ForgeProgress for progress bars
Use ForgeDataTable for data display
Modal Dialogs
Use ForgeModal with open/onClose props
Use ForgeButton with variant="secondary" for cancel
Use ForgeButton with variant="primary" for confirm
Data Tables
Use ForgeDataTable with data and columns props
Add pagination={true} for large datasets
Use custom render functions for actions
Use selectable={true} for bulk operations
Performance Tips
Use selective imports for better tree-shaking
Components include built-in performance monitoring
// All components have AI methods for intelligent interactionsconstbutton=document.querySelector('forge-button')// Get available actionsconstactions=button.getPossibleActions()// Returns: [{ name: 'click', description: 'Click the button', available: true }]// Explain current state conststate=button.explainState()// Returns: { currentState: 'enabled', possibleStates: ['enabled', 'disabled', 'loading'] }// Get comprehensive AI stateconstaiState=button.aiState// Returns: Complete component metadata and current state
Documentation Links
AI Index: ./ai-index.json (quick component discovery)
AI Manifest: ./ai-manifest.json (detailed specifications)
AI Tools: ./ai-tools/ (framework-specific schemas)
AI Methods Guide: ./docs/ai-methods.md
Common Patterns: ./docs/patterns/AI_COMMON_PATTERNS.md
Import Guide: ./docs/guides/AI_IMPORT_GUIDE.md
Avoid These Patterns
Don't import from internal paths like '@nexcraft/forge/src/components'
Don't mix full bundle import with selective imports
Don't use CSS frameworks that conflict with Shadow DOM
Don't use React wrappers with non-React frameworks