diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index b9a9ce378c..ac7164d7b9 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 ce227de355..cd92f1ddff 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 +### 1. PrimeIcons -Custom icons are powered by [unplugin-icons](https://github.com/unplugin/unplugin-icons) and integrate seamlessly with Vue's component system. +```vue + +``` -## Quick Start +[Browse all PrimeIcons →](https://primevue.org/icons/#list) -### 1. Add Your SVG Icon +### 2. Iconify Icons (Recommended) -Place your SVG file in the `custom/` directory: +```vue + ``` -src/assets/icons/custom/ -└── your-icon.svg + +[Browse 200,000+ icons →](https://icon-sets.iconify.design/) + +### 3. Custom Icons + +```vue + ``` -### 2. Use in Components +## Icon Usage Patterns + +### In Buttons ```vue ``` -## SVG Requirements +### 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 -### File Naming -- Use kebab-case: `workflow-icon.svg`, `node-tree.svg` -- Avoid special characters and spaces -- The filename becomes the icon name +- **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 + +```vue + +``` + +No imports needed - icons are auto-discovered! -For icons that adapt to the current theme, use `currentColor`: +## 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 -### Basic Icon -```vue - -``` +### From PrimeIcons to Iconify/Custom -### With Classes ```vue - -``` + ``` -### Conditional Icons +### From Inline SVG to Custom Icon + ```vue -