--- name: chi-recommendations description: Recommend the best Chi implementation approach based on project context. Use when the user asks which Chi approach to use (Vue, Web Components, or HTML/CSS), when starting a new project with Chi, or when migrating between approaches. Provides framework-specific guidance and code examples. --- # Chi Implementation Recommendations ## Decision Tree Use this decision tree to recommend the best approach: ### Step 1: Check Framework | Framework | Recommended Approach | Reasoning | |-----------|---------------------|-----------| | Vue 3 | **chi-vue** | Full Vue reactivity, composition API, TypeScript support | | React | **Custom Elements** | Works with React; note: use `ref` callbacks for event listeners since React synthetic events don't fire on CEs | | Angular | **Custom Elements** | Excellent support via `CUSTOM_ELEMENTS_SCHEMA` in module declarations | | Svelte | **Custom Elements** | Seamless Custom Elements support | | Vanilla JS | **Custom Elements** | Best DX, no framework overhead | | Unknown | **Custom Elements** | Safe default for any framework | ### Step 2: Check Constraints | Constraint | Override To | Reasoning | |------------|------------|-----------| | Legacy browser support (IE11) | **HTML/CSS** | Custom Elements need polyfills | | User explicitly wants CSS | **HTML/CSS** | Respect explicit preference | | User wants Web Components | **Custom Elements** | Respect explicit preference | | Static HTML site (no JS) | **HTML/CSS** | No JS runtime needed | | SSR without hydration | **HTML/CSS** | Custom Elements need JS to initialize | ### Step 3: Determine Confidence | Scenario | Confidence | |----------|------------| | Framework detected + no conflicts | High | | Existing code matches recommendation | High | | No framework info, using default | Low | | Existing code uses different approach | Medium (suggest gradual migration) | ## Code Examples ### Vue Approach ```html ``` ### Custom Elements Approach ```html Click me ``` ### HTML/CSS Approach ```html ``` Note: Requires manual event handling, ARIA attributes, and keyboard support. ## Approach Detection To detect which approach existing code uses: | Pattern | Approach | |---------|----------| | `` is mixed usage -- recommend migrating the button to `` too. ## Migration Paths ### HTML/CSS → Custom Elements 1. Replace CSS base classes with Web Component tags: `