Files
ComfyUI_frontend/docs/guidance/vue-components.md
Christian Byrne ef59f46495 refactor: migrate cn imports from @/utils/tailwindUtil shim to @comfyorg/tailwind-utils directly (#11453)
*PR Created by the Glary-Bot Agent*

---

## Summary

- Replace all `cn` / `ClassValue` imports from the
`@/utils/tailwindUtil` re-export shim with direct imports from
`@comfyorg/tailwind-utils` across 198 source files in `src/` and 3 in
`apps/desktop-ui/`
- Delete both shim files (`src/utils/tailwindUtil.ts` and
`apps/desktop-ui/src/utils/tailwindUtil.ts`)
- Add explicit `@comfyorg/tailwind-utils` dependency to
`apps/desktop-ui/package.json`
- Update documentation references in `AGENTS.md`,
`docs/guidance/design-standards.md`, and
`docs/guidance/vue-components.md`

Fixes #11288

┆Issue is synchronized with this [Notion
page](https://www.notion.so/PR-11453-refactor-migrate-cn-imports-from-utils-tailwindUtil-shim-to-comfyorg-tailwind-utils--3486d73d365081ec92cce91fbf88e6e4)
by [Unito](https://www.unito.io)

---------

Co-authored-by: Glary-Bot <glary-bot@users.noreply.github.com>
Co-authored-by: GitHub Action <action@github.com>
Co-authored-by: Alexander Brown <drjkl@comfy.org>
2026-04-22 18:39:57 -07:00

1.7 KiB

globs
globs
**/*.vue

Vue Component Conventions

Applies to all .vue files anywhere in the codebase.

Vue 3 Composition API

  • Use <script setup lang="ts"> for component logic
  • Destructure props (Vue 3.5 style with defaults) like const { color = 'blue' } = defineProps<...>()
  • Use ref/reactive for state
  • Use computed() for derived state
  • Use lifecycle hooks: onMounted, onUpdated, etc.

Component Communication

  • Prefer emit/@event-name for state changes (promotes loose coupling)
  • Use defineExpose only for imperative operations (form.validate(), modal.open())
  • Proper props and emits definitions

VueUse Composables

Prefer VueUse composables over manual event handling:

  • useElementHover instead of manual mouseover/mouseout listeners
  • useIntersectionObserver for visibility detection instead of scroll handlers
  • useFocusTrap for modal/dialog focus management
  • useEventListener for auto-cleanup event listeners

Prefer Vue native options when available:

  • defineModel instead of useVModel for two-way binding with props

Styling

  • Use inline Tailwind CSS only (no <style> blocks)
  • Use cn() from @comfyorg/tailwind-utils for conditional classes
  • Refer to packages/design-system/src/css/style.css for design tokens and tailwind configuration
  • Exception: when third-party libraries render runtime DOM outside Vue templates (for example xterm internals inside PrimeVue terminal wrappers), scoped :deep() selectors are allowed. Add a brief inline comment explaining why the exception is required.

Best Practices

  • Extract complex conditionals to computed
  • In unmounted hooks, implement cleanup for async operations