diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index b9a9ce378..ac7164d7b 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -255,11 +255,17 @@ npm run format - Add translations to `src/locales/en/main.json` - Use translation keys: `const { t } = useI18n(); t('key.path')` -## Custom Icons +## Icons -The project supports custom SVG icons through the unplugin-icons system. Custom icons are stored in `src/assets/icons/custom/` and can be used as Vue components with the `i-comfy:` prefix. +The project supports three types of icons, all with automatic imports (no manual imports needed): -For detailed instructions on adding and using custom icons, see [src/assets/icons/README.md](src/assets/icons/README.md). +1. **PrimeIcons** - Built-in PrimeVue icons using CSS classes: `` +2. **Iconify Icons** - 200,000+ icons from various libraries: ``, `` +3. **Custom Icons** - Your own SVG icons: `` + +Icons are powered by the unplugin-icons system, which automatically discovers and imports icons as Vue components. Custom icons are stored in `src/assets/icons/custom/`. + +For detailed instructions and code examples, see [src/assets/icons/README.md](src/assets/icons/README.md). ## Working with litegraph.js diff --git a/src/assets/icons/README.md b/src/assets/icons/README.md index ce227de35..cd92f1ddf 100644 --- a/src/assets/icons/README.md +++ b/src/assets/icons/README.md @@ -1,53 +1,148 @@ -# ComfyUI Custom Icons Guide +# ComfyUI Icons Guide -This guide explains how to add and use custom SVG icons in the ComfyUI frontend. +ComfyUI supports three types of icons that can be used throughout the interface. All icons are automatically imported - no manual imports needed! -## Overview +## Quick Start - Code Examples -ComfyUI uses a hybrid icon system that supports: -- **PrimeIcons** - Legacy icon library (CSS classes like `pi pi-plus`) -- **Iconify** - Modern icon system with 200,000+ icons -- **Custom Icons** - Your own SVG icons - -Custom icons are powered by [unplugin-icons](https://github.com/unplugin/unplugin-icons) and integrate seamlessly with Vue's component system. - -## Quick Start - -### 1. Add Your SVG Icon - -Place your SVG file in the `custom/` directory: -``` -src/assets/icons/custom/ -└── your-icon.svg -``` - -### 2. Use in Components +### 1. PrimeIcons ```vue +``` + +[Browse all PrimeIcons →](https://primevue.org/icons/#list) + +### 2. Iconify Icons (Recommended) + +```vue + +``` + +[Browse 200,000+ icons →](https://icon-sets.iconify.design/) + +### 3. Custom Icons + +```vue + ``` -## SVG Requirements +## Icon Usage Patterns -### File Naming -- Use kebab-case: `workflow-icon.svg`, `node-tree.svg` -- Avoid special characters and spaces -- The filename becomes the icon name +### In Buttons + +```vue + +``` + +### Conditional Icons + +```vue + +``` + +### With Tooltips + +```vue + +``` + +## Using Iconify Icons + +### Finding Icons + +1. Visit [Iconify Icon Sets](https://icon-sets.iconify.design/) +2. Search or browse collections +3. Click on any icon to get its name +4. Use with `i-[collection]:[icon-name]` format + +### Popular Collections + +- **Lucide** (`i-lucide:`) - Our primary icon set, clean and consistent +- **Material Design Icons** (`i-mdi:`) - Comprehensive Material Design icons +- **Heroicons** (`i-heroicons:`) - Beautiful hand-crafted SVG icons +- **Tabler** (`i-tabler:`) - 3000+ free SVG icons +- **Carbon** (`i-carbon:`) - IBM's design system icons + +## Adding Custom Icons + +### 1. Add Your SVG + +Place your SVG file in `src/assets/icons/custom/`: + +``` +src/assets/icons/custom/ +├── workflow-duplicate.svg +├── node-preview.svg +└── your-icon.svg +``` + +### 2. SVG Format Requirements -### SVG Format ```xml - + + ``` @@ -57,59 +152,98 @@ src/assets/icons/custom/ - Use `currentColor` for theme-aware icons - Keep SVGs optimized and simple -### Color Theming +### 3. Use Immediately -For icons that adapt to the current theme, use `currentColor`: +```vue + +``` + +No imports needed - icons are auto-discovered! + +## Icon Guidelines + +### Naming Conventions + +- **Files**: `kebab-case.svg` (workflow-icon.svg) +- **Usage**: `` + +### Size & Styling + +```vue + +``` + +### Theme Compatibility + +Always use `currentColor` in SVGs for automatic theme adaptation: ```xml - + - + - + - + ``` -## Usage Examples +## Migration Guide + +### From PrimeIcons to Iconify/Custom -### Basic Icon ```vue - + ``` -### With Classes -```vue - -``` +### From Inline SVG to Custom Icon -### In Buttons ```vue - -``` +