Monicon is an easy-to-use icon library that makes adding icons to your projects simple. It works with popular frameworks like React, React Native, Next.js, Vue, Nuxt, Svelte and more. It's provides 200,000+ icons from popular sets like Material Design, Feather, and Font Awesome.
================================================
FILE: apps/docs/.gitignore
================================================
# deps
/node_modules
# generated content
.source
# test & build
/coverage
/.next/
/out/
/build
*.tsbuildinfo
# misc
.DS_Store
*.pem
/.pnp
.pnp.js
npm-debug.log*
yarn-debug.log*
yarn-error.log*
# others
.env*.local
.vercel
next-env.d.ts
================================================
FILE: apps/docs/README.md
================================================
# docs
This is a Next.js application generated with
[Create Fumadocs](https://github.com/fuma-nama/fumadocs).
Run development server:
```bash
npm run dev
# or
pnpm dev
# or
yarn dev
```
Open http://localhost:3000 with your browser to see the result.
## Explore
In the project, you can see:
- `lib/source.ts`: Code for content source adapter, [`loader()`](https://fumadocs.dev/docs/headless/source-api) provides the interface to access your content.
- `lib/layout.shared.tsx`: Shared options for layouts, optional but preferred to keep.
| Route | Description |
| ------------------------- | ------------------------------------------------------ |
| `app/(home)` | The route group for your landing page and other pages. |
| `app/docs` | The documentation layout and pages. |
| `app/api/search/route.ts` | The Route Handler for search. |
### Fumadocs MDX
A `source.config.ts` config file has been included, you can customise different options like frontmatter schema.
Read the [Introduction](https://fumadocs.dev/docs/mdx) for further details.
## Learn More
To learn more about Next.js and Fumadocs, take a look at the following
resources:
- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js
features and API.
- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.
- [Fumadocs](https://fumadocs.dev) - learn about Fumadocs
================================================
FILE: apps/docs/content/docs/architecture.mdx
================================================
---
title: Architecture
description: Understand Monicon's architecture, package structure, and how components work together
---
This guide explains Monicon's architecture, including package dependencies, the icon generation flow, and how different components work together.
## Overview
Monicon is built as a monorepo with multiple packages that work together to provide a flexible, framework-agnostic icon management system. The architecture is designed to be modular, extensible, and easy to integrate with different build tools and frameworks.
## Package Structure
B[@monicon/cli]
A --> C[@monicon/vite]
A --> D[@monicon/webpack]
A --> E[@monicon/rollup]
A --> F[@monicon/esbuild]
A --> G[@monicon/rspack]
A --> H[@monicon/metro]
A --> I[@monicon/nuxt]
style A fill:#059669,stroke:#047857,color:#fff
style B fill:#2563eb,stroke:#1d4ed8,color:#fff
style C fill:#d97706,stroke:#b45309,color:#fff
style D fill:#d97706,stroke:#b45309,color:#fff
style E fill:#d97706,stroke:#b45309,color:#fff
style F fill:#d97706,stroke:#b45309,color:#fff
style G fill:#d97706,stroke:#b45309,color:#fff
style H fill:#d97706,stroke:#b45309,color:#fff
style I fill:#d97706,stroke:#b45309,color:#fff
`}/>
### Core Packages
#### @monicon/core (Core Engine)
The heart of Monicon, containing all the core functionality:
- **Bootstrap Function**: Entry point for icon generation
- **Loaders**: Fetch icons from different sources (remote, local, JSON)
- **Plugins**: Transform icons into framework-specific components
- **Utilities**: Config loading, file system operations, icon processing
#### @monicon/cli (Command Line Interface)
Command-line tool for generating icons outside of build processes. Uses `@monicon/core` to provide a CLI experience.
### Bundler Integration Packages
All bundler packages depend on `@monicon/core` and provide seamless integration:
- **@monicon/vite** - Vite plugin
- **@monicon/webpack** - Webpack plugin
- **@monicon/rollup** - Rollup plugin
- **@monicon/esbuild** - esbuild plugin
- **@monicon/rspack** - Rspack plugin
- **@monicon/metro** - Metro bundler plugin (React Native)
- **@monicon/nuxt** - Nuxt module
## Core Architecture
The `@monicon/core` package is structured into four main components:
B[Loaders]
A --> C[Plugins]
A --> D[Utils]
B --> B1[Remote Collection]
B --> B2[Local Collection]
B --> B3[JSON Collection]
C --> C0[Generic Plugin]
C --> C7[Clean Plugin]
C --> C8[Debugger Plugin]
C0 --> P1[React Plugin]
C0 --> P2[Vue Plugin]
C0 --> P3[Svelte Plugin]
C0 --> P4[Qwik Plugin]
C0 --> P5[React Native Plugin]
C0 --> P6[SVG Plugin]
D --> D1[Config Loader]
D --> D2[File System]
D --> D3[Icon Processor]
D --> D4[Plugin Loader]
D --> D5[SVG Utils]
style A fill:#059669,stroke:#047857,color:#fff
style B fill:#2563eb,stroke:#1d4ed8,color:#fff
style C fill:#d97706,stroke:#b45309,color:#fff
style D fill:#7c3aed,stroke:#6d28d9,color:#fff
`}
/>
### Components
#### Bootstrap
Entry point that orchestrates the entire icon generation process. It:
- Loads configuration
- Processes icons
- Runs plugins
- Writes output files
#### Loaders
Fetch icons from various sources:
- **Remote Collection**: Fetch from Iconify CDN
- **Local Collection**: Load from local file system
- **JSON Collection**: Load from JSON files
#### Plugins
Transform raw SVG icons into framework-specific components:
- **Generic Plugin**: Base plugin providing file generation capabilities (used internally by framework plugins)
- **React Plugin**: Generate React/JSX components (built on Generic Plugin)
- **Vue Plugin**: Generate Vue SFC components (built on Generic Plugin)
- **Svelte Plugin**: Generate Svelte components (built on Generic Plugin)
- **Qwik Plugin**: Generate Qwik components (built on Generic Plugin)
- **React Native Plugin**: Generate React Native components with react-native-svg (built on Generic Plugin)
- **SVG Plugin**: Generate plain SVG files (built on Generic Plugin)
- **Clean Plugin**: Clean output directories
- **Debugger Plugin**: Debug icon generation
#### Utils
Helper utilities for various operations:
- **Config Loader**: Load and watch configuration files
- **File System**: Handle file operations
- **Icon Processor**: Process and transform icons
- **Plugin Loader**: Load and execute plugins
- **SVG Utils**: Parse and manipulate SVG content
## Plugin System
Plugins are the core of Monicon's extensibility. Here's how the plugin system works:
B[onPluginsLoad Hook]
B --> C[beforeGenerate Hook]
C --> D[Plugin 1]
C --> E[Plugin 2]
C --> F[Plugin N]
D --> D1[generate]
E --> E1[generate]
F --> F1[generate]
D1 --> G[Collect All Files]
E1 --> G
F1 --> G
G --> H[afterGenerate Hook]
H --> I[beforeWriteFiles Hook]
I --> J[Write to Disk]
J --> K[afterWriteFiles Hook]
style A fill:#059669,stroke:#047857,color:#fff
style G fill:#2563eb,stroke:#1d4ed8,color:#fff
style J fill:#d97706,stroke:#b45309,color:#fff
`}
/>
### Plugin Lifecycle
Each plugin can implement the following hooks:
1. **onPluginsLoad**: Called when plugins are loaded (optional)
2. **beforeGenerate**: Called before the generation process starts (optional)
3. **generate**: The main generation function that creates output files (required)
4. **afterGenerate**: Called after the generation process completes (optional)
5. **beforeWriteFiles**: Called before files are written to disk (optional)
6. **afterWriteFiles**: Called after files are written to disk (optional)
### Creating Custom Plugins
Plugins are functions that return a configuration object:
```ts twoslash
import { MoniconPlugin, MoniconPluginFile } from "@monicon/core/plugins";
export const txtPlugin: MoniconPlugin = (options) => (payload) => {
return {
name: "monicon-txt-plugin",
generate: () => {
const files: MoniconPluginFile[] = [];
for (const icon of payload.icons) {
files.push({
path: `output/${icon.name}.txt`,
content: icon.svg,
});
}
return files;
},
};
};
```
### Generic Plugin Foundation
Most framework plugins (React, Vue, Svelte, Qwik, React Native, and SVG) are built on top of the **Generic Plugin**. The Generic Plugin provides a reusable foundation for file generation with flexible options:
- **outputPath**: Function or string to determine where files are generated
- **fileName**: Function or string to determine file names
- **extension**: Function or string to determine file extensions
- **content**: Function or string to generate file content
This architecture allows framework plugins to focus on their specific transformations (e.g., converting SVG to React JSX) while delegating file management to the generic plugin.
```ts twoslash
import {
generic,
GenericPluginOptions,
MoniconPlugin,
} from "@monicon/core/plugins";
type CustomPluginOptions = GenericPluginOptions;
type CustomPluginInternalOptions = {
foo?: string;
};
export const customPlugin: MoniconPlugin = (options) =>
generic({
name: "my-custom-plugin",
extension: "custom",
content: (icon) => `/* Custom content for ${icon.name} */`,
...options,
});
```
## Bundler Integration Flow
Bundler packages integrate Monicon into the build process:
B[Bundler Plugin Initialized]
B --> C[Load Monicon Config]
C --> D[Watch Config File]
D --> E{Config File Changed?}
E -->|Yes| F[Trigger Icon Generation]
F --> G[Bootstrap Process]
G --> H[Generate Icon Components]
H --> I[Files Written]
style A fill:#059669,stroke:#047857,color:#fff
style G fill:#2563eb,stroke:#1d4ed8,color:#fff
`}
/>
### How Bundler Plugins Work
1. **Initialize**: Plugin is loaded by the bundler during startup
2. **Load Config**: Load Monicon configuration from `monicon.config.ts`
3. **Watch**: Watch the config file for changes
4. **Generate**: When changes are detected, trigger icon generation via `bootstrap()`
## Data Flow Example
Let's trace a complete example of generating a React icon component:
>CLI: npx @monicon/cli generate
CLI->>Bootstrap: bootstrap(config)
Bootstrap->>Loader: Load icons ["mdi:home"]
Loader->>Loader: Fetch from Iconify CDN
Loader-->>Bootstrap: Raw SVG data
Bootstrap->>IconProcessor: Process icons
IconProcessor->>IconProcessor: Parse SVG
IconProcessor->>IconProcessor: Normalize dimensions
IconProcessor-->>Bootstrap: Processed icons
Bootstrap->>ReactPlugin: generate(icons)
ReactPlugin->>ReactPlugin: Transform to JSX
ReactPlugin->>ReactPlugin: Apply template
ReactPlugin-->>Bootstrap: File objects
Bootstrap->>FileSystem: Write files
FileSystem->>FileSystem: Create directories
FileSystem->>FileSystem: Write components
FileSystem-->>Bootstrap: Success
Bootstrap-->>CLI: Complete
CLI-->>User: Icons generated!
`}
/>
## Key Design Principles
### 1. Framework Agnostic
The core is framework-agnostic. Framework-specific logic is isolated in plugins, making it easy to support new frameworks.
### 2. Build Tool Independent
Bundler integration packages are separate, allowing users to choose their preferred build tool or use the CLI.
### 3. Extensible
The plugin system allows users to create custom transformations and integrations.
### 4. Type Safe
Full TypeScript support with exported types for configuration and plugins.
## Examples
### Using Core Directly
```ts twoslash
import { bootstrap } from "@monicon/core";
import { react } from "@monicon/core/plugins";
await bootstrap({
icons: ["mdi:home"],
plugins: [react({ outputPath: "src/components/icons" })],
});
```
### Using with Vite
```ts twoslash
import { defineConfig } from "vite";
import monicon from "@monicon/vite";
import { react } from "@monicon/core/plugins";
export default defineConfig({
plugins: [
monicon({
icons: ["mdi:home"],
plugins: [react({ outputPath: "src/components/icons" })],
}),
],
});
```
### Using CLI
```bash
npx @monicon/cli generate --watch
```
================================================
FILE: apps/docs/content/docs/index.mdx
================================================
---
title: Introduction
description: Monicon is an easy-to-use icon orchestration tool that makes adding icons to your projects simple.
---
Monicon is an tool agnostic and easy-to-use icon orchestration tool that makes adding icons to your projects simple. It works with any framework, language, and platform.
- **Tool Agnostic**: Works with any framework, language, and platform.
- **Huge Icon Library**: Get access to over 200,000 icons from famous sets like Material Design, Feather, and Font Awesome.
- **Custom Icons**: You can create custom icons and use them in your projects. Monicon makes it easy to add your own icons.
- **Works with Modern Tools**: Monicon supports tools like Vite, Webpack, Rollup, and others, so it's ready for any project.
- **Fast and Efficient**: Monicon loads icons quickly to keep your project running smoothly. No flickering or lagging.
- **Easy to Use**: Works with React, Vue, Svelte, Next.js, and other popular frameworks, making icon integration simple. You can discover icons on the [Icones](https://icones.js.org/) website.
- **Customizable**: You can easily change the size, color, and other features of the icons to fit your design.
- **Collaboration**: Monicon helps you collaborate with designers to speed up the design process and get better results. [Iconify Figma Plugin](https://www.figma.com/community/plugin/735098390272716381/iconify) allows you to use icons directly in Figma.
- **Free and Open Source**: Monicon is free to use and open source, so you can use it in any project without restrictions.
No matter which framework you use, Monicon makes adding and managing icons easy. Check out the documentation to see how Monicon can help improve your next project with great-looking icons!
## Comparison: Monicon & Iconify & unplugin-icons
| Feature | Monicon | @iconify/react | unplugin-icons |
| -------------------------- | --------------------------------------------------------------------------------------------- | --------------------------------------------------------------------- | --------------------------------------------------------------------- |
| **Tool Agnostic** | Works with any framework, language, and platform. | Works with React, Vue, Svelte, Next.js, and other popular frameworks. | Works with React, Vue, Svelte, Next.js, and other popular frameworks. |
| **Icon Rendering** | Icons are bundled during build time, ensuring instant rendering with no blinking. | Icons load over HTTP, which can cause blinking during rendering. | Icons are bundled at build time, no blinking issues. |
| **Offline Support** | Fully offline-compatible, works seamlessly with PWAs, Electron apps, and native environments. | Does not work offline due to reliance on HTTP for fetching icons. | Works offline |
| **React Native Support** | Fully supports React Native, making it ideal for mobile and native projects. | No support for React Native. | No support for React Native. |
| **Modern Bundler Support** | Compatible with Metro, Vite, Webpack, Rollup, Rspack, and others. | Primarily web-focused and lacks versatility across bundlers. | No support for Metro. |
| **Custom Icon Support** | Easily create and use custom icons in your projects. | Easily create and use custom icons in your projects. | Easily create and use custom icons in your projects. |
================================================
FILE: apps/docs/content/docs/installation/cli.mdx
================================================
---
title: CLI
description: Learn how to use the Monicon CLI to generate icons
---
The Monicon CLI provides a command-line interface for generating icons, this is useful if you want to use Monicon as a tool-agnostic.
## Installation
Install the Monicon Core
```bash tab="npm"
npm install @monicon/core
```
```bash tab="pnpm"
pnpm add @monicon/core
```
```bash tab="yarn"
yarn add @monicon/core
```
```bash tab="bun"
bun add @monicon/core
```
## Configuration
Create a `monicon.config.ts` (or `.js`) file in your project root:
```ts twoslash title="monicon.config.ts"
import { svg, clean } from "@monicon/core/plugins";
import { MoniconConfig } from "@monicon/core";
export default {
// Loads individual icons by icon name
icons: ["mdi:home", "feather:activity"],
// Loads all icons from a collection
collections: ["lucide"],
plugins: [
clean({ patterns: ["src/components/icons"] }),
svg({ outputPath: "src/components/icons" }),
],
} satisfies MoniconConfig;
```
## Commands
### Generate Icons
Generate icons based on your configuration:
```bash
npx @monicon/cli generate
```
This command will:
1. Load your `monicon.config.ts` file
2. Fetch the specified icons
3. Generate components in the configured output path
### Watch Mode
Run the CLI in watch mode to automatically regenerate icons when your config changes:
```bash
npx @monicon/cli generate -w
```
This is useful during development to see changes immediately.
### Help
Display help information:
```bash
npx @monicon/cli -h
```
### Version
Check the installed CLI version:
```bash
npx @monicon/cli -v
```
## Usage in Scripts
You can add the CLI to your `package.json` scripts for easy access:
```json title="package.json"
{
"scripts": {
"dev": "npx @monicon/cli generate --watch && next dev",
"build": "npx @monicon/cli generate && next build"
}
}
```
================================================
FILE: apps/docs/content/docs/installation/esbuild.mdx
================================================
---
title: React (esbuild)
description: Learn how to install and use Monicon in your React (esbuild) project
---
## Installation
Install Monicon and its esbuild plugin in your project:
```bash tab="npm"
npm install @monicon/core @monicon/esbuild
```
```bash tab="pnpm"
pnpm add @monicon/core @monicon/esbuild
```
```bash tab="yarn"
yarn add @monicon/core @monicon/esbuild
```
```bash tab="bun"
bun add @monicon/core @monicon/esbuild
```
## Configuration
### 1. Create Monicon Config
Create a `monicon.config.ts` file in your project root:
```ts twoslash title="monicon.config.ts"
import { react, clean } from "@monicon/core/plugins";
import { MoniconConfig } from "@monicon/core";
export default {
// Loads individual icons by icon name
icons: ["mdi:home", "feather:activity"],
// Loads all icons from the lucide collection
collections: ["lucide"],
plugins: [
/**
* change the output path to your project config for example;
* - src/components/icons
* - components/icons
*/
clean({ patterns: ["src/components/icons"] }),
react({ outputPath: "src/components/icons" }),
],
} satisfies MoniconConfig;
```
### 2. Configure esbuild
Add the Monicon plugin to your esbuild configuration:
```js title="build.js"
import * as esbuild from "esbuild";
import { monicon } from "@monicon/esbuild";
await esbuild.build({
plugins: [monicon()],
});
```
## Usage
After configuration, Monicon will automatically generate React components for your icons. You can import and use them in your components:
```tsx title="src/App.tsx"
import BadgeCheckIcon from "./components/icons/lucide/badge-check";
import CloudDownloadIcon from "./components/icons/lucide/cloud-download";
import HomeIcon from "./components/icons/mdi/home";
import ActivityIcon from "./components/icons/feather/activity";
export default function App() {
return (
{/* you can also use standard SVG props */}
);
}
```
================================================
FILE: apps/docs/content/docs/installation/library.mdx
================================================
---
title: Library
description: Learn how to use Monicon programmatically as a library
---
Monicon can be used programmatically as a library, giving you full control over icon generation in your build scripts, custom tooling, or any other project.
## Installation
Install the Monicon Core
```bash tab="npm"
npm install @monicon/core
```
```bash tab="pnpm"
pnpm add @monicon/core
```
```bash tab="yarn"
yarn add @monicon/core
```
```bash tab="bun"
bun add @monicon/core
```
## Basic Usage
Import the `bootstrap` function from `@monicon/core` and call it with your configuration:
```ts twoslash title="scripts/generate-icons.ts"
import { bootstrap } from "@monicon/core";
import { svg, clean } from "@monicon/core/plugins";
await bootstrap({
// Loads individual icons by icon name
icons: ["mdi:home", "feather:activity"],
// Loads all icons from a collection
collections: ["lucide"],
plugins: [
clean({ patterns: ["src/components/icons"] }),
svg({ outputPath: "src/components/icons" }),
],
watch: false, // Set to true for watch mode
});
```
## Configuration
The `bootstrap` function accepts a configuration object with the following options:
### Type Definition
```ts twoslash
import { MoniconConfig } from "@monicon/core";
```
### Configuration Options
| Option | Type | Default | Description |
| ------------- | ------------------------------------ | ------- | --------------------------------------------------------------------------------- |
| `icons` | `string[]` | `[]` | Array of individual icon names to load (e.g., `["mdi:home", "feather:activity"]`) |
| `collections` | `string[]` | `[]` | Array of complete icon collections to load (e.g., `["lucide", "heroicons"]`) |
| `plugins` | `MoniconPlugin[]` | `[]` | Array of plugins to process icons |
| `loaders` | `Record>` | `{}` | Custom loaders for loading icons from different sources |
| `watch` | `boolean` | `false` | Enable watch mode to automatically regenerate icons on config changes |
## Using with Config File
The `bootstrap` function automatically loads your `monicon.config.ts` file if it exists, and merges it with any options you pass:
```ts twoslash title="scripts/generate-icons.ts"
import { bootstrap } from "@monicon/core";
// This will load monicon.config.ts and merge with the provided options
await bootstrap({
watch: false, // Override watch mode
});
```
```ts twoslash title="monicon.config.ts"
import { svg, clean } from "@monicon/core/plugins";
import { MoniconConfig } from "@monicon/core";
export default {
icons: ["mdi:home", "feather:activity"],
collections: ["lucide"],
plugins: [
clean({ patterns: ["src/components/icons"] }),
svg({ outputPath: "src/components/icons" }),
],
} satisfies MoniconConfig;
```
## Integration Examples
### Custom Build Script
Create a custom build script that generates icons before building your app:
```ts twoslash title="scripts/build.ts"
import { bootstrap } from "@monicon/core";
import { svg } from "@monicon/core/plugins";
import { execSync } from "child_process";
async function build() {
console.log("Generating icons...");
await bootstrap({
icons: ["mdi:home", "feather:activity"],
plugins: [svg({ outputPath: "src/components/icons" })],
watch: false,
});
console.log("Building application...");
execSync("npm run build:app", { stdio: "inherit" });
}
build().catch(console.error);
```
```json title="package.json"
{
"scripts": {
"build": "tsx scripts/build.ts"
}
}
```
### Pre-build Hook
Use Monicon in a pre-build hook:
```json twoslash title="package.json"
{
"scripts": {
"prebuild": "tsx scripts/generate-icons.ts",
"build": "vite build"
}
}
```
```ts twoslash title="scripts/generate-icons.ts"
import { bootstrap } from "@monicon/core";
import { svg } from "@monicon/core/plugins";
await bootstrap({
icons: ["mdi:home", "feather:activity", "lucide:star"],
plugins: [svg({ outputPath: "src/components/icons" })],
watch: false,
});
```
### Watch Mode for Development
Use watch mode during development:
```ts twoslash title="scripts/dev.ts"
import { bootstrap } from "@monicon/core";
import { react } from "@monicon/core/plugins";
// Generate icons with watch mode
await bootstrap({
icons: ["mdi:home", "feather:activity"],
plugins: [react({ outputPath: "src/components/icons" })],
watch: true,
});
console.log("Icon generator running in watch mode...");
```
================================================
FILE: apps/docs/content/docs/installation/meta.json
================================================
{
"title": "Installation",
"pages": [
"cli",
"library",
"universal-build-tool",
"react",
"nextjs",
"remix",
"qwik",
"react-native",
"vue",
"nuxt",
"svelte",
"rollup",
"rspack",
"webpack",
"esbuild"
]
}
================================================
FILE: apps/docs/content/docs/installation/nextjs.mdx
================================================
---
title: Next.js
description: Learn how to install and use Monicon in your Next.js project
---
## Installation
Install Monicon and its Webpack plugin in your Next.js project:
```bash tab="npm"
npm install @monicon/core @monicon/webpack
```
```bash tab="pnpm"
pnpm add @monicon/core @monicon/webpack
```
```bash tab="yarn"
yarn add @monicon/core @monicon/webpack
```
```bash tab="bun"
bun add @monicon/core @monicon/webpack
```
## Configuration
### 1. Create Monicon Config
Create a `monicon.config.ts` file in your project root:
```ts twoslash title="monicon.config.ts"
import { react, clean } from "@monicon/core/plugins";
import { MoniconConfig } from "@monicon/core";
export default {
// Loads individual icons by icon name
icons: ["mdi:home", "feather:heart"],
// Loads all icons from the lucide collection
collections: ["lucide"],
plugins: [
/**
* change the output path to your project config for example;
* - components/icons
* - src/components/icons
*/
clean({ patterns: ["components/icons"] }),
react({ outputPath: "components/icons" }),
],
} satisfies MoniconConfig;
```
### 2. Configure Next.js
Add the Monicon plugin to your `next.config.mjs`:
```js title="next.config.mjs"
import { MoniconPlugin } from "@monicon/webpack";
const nextConfig = {
reactStrictMode: true,
webpack: (config, { dev }) => {
config.plugins.push(new MoniconPlugin({ watch: dev }));
return config;
},
};
export default nextConfig;
```
The `watch: dev` option enables automatic icon regeneration during development
when your config changes.
## Usage
After configuration, Monicon will automatically generate React components for your icons. You can import and use them in your components:
```tsx title="app/page.tsx"
import BadgeCheckIcon from "./components/icons/lucide/badge-check";
import CloudDownloadIcon from "./components/icons/lucide/cloud-download";
import HomeIcon from "./components/icons/mdi/home";
import HeartIcon from "./components/icons/feather/heart";
export default function Home() {
return (
{/* if you don't want to use the className prop, you can use the svg props */}
);
}
```
================================================
FILE: apps/docs/content/docs/installation/nuxt.mdx
================================================
---
title: Nuxt
description: Learn how to install and use Monicon in your Nuxt project
---
## Installation
Install Monicon and its Nuxt module in your Nuxt project:
```bash tab="npm"
npm install @monicon/core @monicon/nuxt
```
```bash tab="pnpm"
pnpm add @monicon/core @monicon/nuxt
```
```bash tab="yarn"
yarn add @monicon/core @monicon/nuxt
```
```bash tab="bun"
bun add @monicon/core @monicon/nuxt
```
## Configuration
### 1. Create Monicon Config
Create a `monicon.config.ts` file in your project root:
```ts twoslash title="monicon.config.ts"
import { vue, clean } from "@monicon/core/plugins";
import { MoniconConfig } from "@monicon/core";
export default {
// Loads individual icons by icon name
icons: ["mdi:home", "feather:activity"],
// Loads all icons from the lucide collection
collections: ["lucide"],
plugins: [
/**
* change the output path to your project config for example;
* - components/icons
* - src/components/icons
*/
clean({ patterns: ["components/icons"] }),
vue({ outputPath: "components/icons" }),
],
} satisfies MoniconConfig;
```
### 2. Configure Nuxt
Add the Monicon module to your `nuxt.config.ts`:
```ts title="nuxt.config.ts"
export default defineNuxtConfig({
modules: ["@monicon/nuxt"],
});
```
## Usage
After configuration, Monicon will automatically generate Vue components for your icons. You can import and use them in your pages and components:
```vue title="app.vue"
```
================================================
FILE: apps/docs/content/docs/installation/qwik.mdx
================================================
---
title: Qwik
description: Learn how to install and use Monicon in your Qwik project
---
## Installation
Install Monicon and its Vite plugin in your Qwik project:
```bash tab="npm"
npm install @monicon/core @monicon/vite
```
```bash tab="pnpm"
pnpm add @monicon/core @monicon/vite
```
```bash tab="yarn"
yarn add @monicon/core @monicon/vite
```
```bash tab="bun"
bun add @monicon/core @monicon/vite
```
## Configuration
### 1. Create Monicon Config
Create a `monicon.config.ts` file in your project root:
```ts twoslash title="monicon.config.ts"
import { qwik, clean } from "@monicon/core/plugins";
import { MoniconConfig } from "@monicon/core";
export default {
// Loads individual icons by icon name
icons: ["mdi:home", "feather:activity"],
// Loads all icons from the lucide collection
collections: ["lucide"],
plugins: [
/**
* change the output path to your project config for example;
* - src/components/icons
* - components/icons
*/
clean({ patterns: ["src/components/icons"] }),
qwik({ outputPath: "src/components/icons" }),
],
} satisfies MoniconConfig;
```
### 2. Configure Vite
Add the Monicon plugin to your `vite.config.ts`:
```ts twoslash title="vite.config.ts"
import { defineConfig, type UserConfig } from "vite";
import { monicon } from "@monicon/vite";
export default defineConfig((): UserConfig => {
return {
plugins: [
// ... other plugins
monicon(),
],
};
});
```
## Usage
After configuration, Monicon will automatically generate Qwik components for your icons. You can import and use them in your routes and components:
```tsx title="src/routes/index.tsx"
import { component$ } from "@builder.io/qwik";
import type { DocumentHead } from "@builder.io/qwik-city";
import BadgeCheckIcon from "~/components/icons/lucide/badge-check";
import CloudDownloadIcon from "~/components/icons/lucide/cloud-download";
import HomeIcon from "~/components/icons/mdi/home";
import ActivityIcon from "~/components/icons/feather/activity";
export default component$(() => {
return (
{/* you can use standard SVG props */}
);
});
export const head: DocumentHead = {
title: "Welcome to Qwik",
meta: [
{
name: "description",
content: "Qwik site description",
},
],
};
```
================================================
FILE: apps/docs/content/docs/installation/react-native.mdx
================================================
---
title: React Native
description: Learn how to install and use Monicon in your React Native project
---
## Installation
Install Monicon and its Metro plugin in your React Native project:
```bash tab="npm"
npm install @monicon/core @monicon/metro react-native-svg
```
```bash tab="pnpm"
pnpm add @monicon/core @monicon/metro react-native-svg
```
```bash tab="yarn"
yarn add @monicon/core @monicon/metro react-native-svg
```
```bash tab="bun"
bun add @monicon/core @monicon/metro react-native-svg
```
`react-native-svg` is required for rendering SVG icons in React Native.
## Configuration
### 1. Create Monicon Config
Create a `monicon.config.ts` file in your project root:
```ts twoslash title="monicon.config.ts"
import { reactNative, clean } from "@monicon/core/plugins";
import { MoniconConfig } from "@monicon/core";
export default {
// Loads individual icons by icon name
icons: ["mdi:home", "feather:activity"],
// Loads all icons from the lucide collection
collections: ["lucide"],
plugins: [
/**
* change the output path to your project config for example;
* - components/icons
* - src/components/icons
*/
clean({ patterns: ["components/icons"] }),
reactNative({ outputPath: "components/icons" }),
],
} satisfies MoniconConfig;
```
### 2. Configure Metro
Update your `metro.config.js` to use the Monicon Metro plugin:
```js title="metro.config.js"
const { getDefaultConfig } = require("expo/metro-config");
const { withMonicon } = require("@monicon/metro");
const config = getDefaultConfig(__dirname);
const configWithMonicon = withMonicon(config);
module.exports = configWithMonicon;
```
## Usage
After configuration, Monicon will automatically generate React Native components for your icons. You can import and use them in your components:
```tsx title="app/(tabs)/index.tsx"
import { StyleSheet, View } from "react-native";
import BadgeCheckIcon from "@/components/icons/lucide/badge-check";
import CloudDownloadIcon from "@/components/icons/lucide/cloud-download";
import HomeIcon from "@/components/icons/mdi/home";
import ActivityIcon from "@/components/icons/feather/activity";
export default function HomeScreen() {
return (
);
}
const styles = StyleSheet.create({
container: {
flex: 1,
flexDirection: "row",
alignItems: "center",
justifyContent: "center",
gap: 10,
},
});
```
================================================
FILE: apps/docs/content/docs/installation/react.mdx
================================================
---
title: React
description: Learn how to install and use Monicon in your React (Vite) project
---
## Installation
Install Monicon and its Vite plugin in your React project:
```bash tab="npm"
npm install @monicon/core @monicon/vite
```
```bash tab="pnpm"
pnpm add @monicon/core @monicon/vite
```
```bash tab="yarn"
yarn add @monicon/core @monicon/vite
```
```bash tab="bun"
bun add @monicon/core @monicon/vite
```
## Configuration
### 1. Create Monicon Config
Create a `monicon.config.ts` file in your project root:
```ts twoslash title="monicon.config.ts"
import { react, clean } from "@monicon/core/plugins";
import { MoniconConfig } from "@monicon/core";
export default {
// Loads individual icons by icon name
icons: ["mdi:home", "feather:heart"],
// Loads all icons from the lucide collection
collections: ["lucide"],
plugins: [
/**
* change the output path to your project config for example;
* - src/components/icons
* - components/icons
*/
clean({ patterns: ["src/components/icons"] }),
react({ outputPath: "src/components/icons" }),
],
} satisfies MoniconConfig;
```
### 2. Configure Vite
Add the Monicon plugin to your `vite.config.ts`:
```ts twoslash title="vite.config.ts"
import { defineConfig } from "vite";
import monicon from "@monicon/vite";
export default defineConfig({
plugins: [
// ... other plugins
monicon(),
],
});
```
## Usage
After configuration, Monicon will automatically generate React components for your icons. You can import and use them in your components:
```tsx title="src/App.tsx"
import BadgeCheckIcon from "./components/icons/lucide/badge-check";
import CloudDownloadIcon from "./components/icons/lucide/cloud-download";
import HomeIcon from "./components/icons/mdi/home";
import HeartIcon from "./components/icons/feather/heart";
function App() {
return (
{/* if you don't want to use the className prop, you can use the svg props */}
);
}
export default App;
```
================================================
FILE: apps/docs/content/docs/installation/remix.mdx
================================================
---
title: Remix
description: Learn how to install and use Monicon in your Remix project
---
## Installation
Install Monicon and its Vite plugin in your Remix project:
```bash tab="npm"
npm install @monicon/core @monicon/vite
```
```bash tab="pnpm"
pnpm add @monicon/core @monicon/vite
```
```bash tab="yarn"
yarn add @monicon/core @monicon/vite
```
```bash tab="bun"
bun add @monicon/core @monicon/vite
```
## Configuration
### 1. Create Monicon Config
Create a `monicon.config.ts` file in your project root:
```ts twoslash title="monicon.config.ts"
import { react, clean } from "@monicon/core/plugins";
import { MoniconConfig } from "@monicon/core";
export default {
// Loads individual icons by icon name
icons: ["mdi:home", "feather:activity"],
// Loads all icons from the lucide collection
collections: ["lucide"],
plugins: [
/**
* change the output path to your project config for example;
* - app/components/icons
* - src/components/icons
*/
clean({ patterns: ["app/components/icons"] }),
react({ outputPath: "app/components/icons" }),
],
} satisfies MoniconConfig;
```
### 2. Configure Vite
Add the Monicon plugin to your `vite.config.ts`:
```ts twoslash title="vite.config.ts"
import { defineConfig } from "vite";
import monicon from "@monicon/vite";
export default defineConfig({
plugins: [
// ... other plugins
monicon(),
],
});
```
## Usage
After configuration, Monicon will automatically generate React components for your icons. You can import and use them in your routes and components:
```tsx title="app/routes/_index.tsx"
import type { MetaFunction } from "@remix-run/node";
import BadgeCheckIcon from "~/components/icons/lucide/badge-check";
import CloudDownloadIcon from "~/components/icons/lucide/cloud-download";
import HomeIcon from "~/components/icons/mdi/home";
import ActivityIcon from "~/components/icons/feather/activity";
export const meta: MetaFunction = () => {
return [
{ title: "New Remix App" },
{ name: "description", content: "Welcome to Remix!" },
];
};
export default function Index() {
return (
{/* if you don't want to use the className prop, you can use the svg props */}
);
}
```
================================================
FILE: apps/docs/content/docs/installation/rollup.mdx
================================================
---
title: React (Rollup)
description: Learn how to install and use Monicon in your Rollup project
---
## Installation
Install Monicon and its Rollup plugin in your project:
```bash tab="npm"
npm install @monicon/core @monicon/rollup
```
```bash tab="pnpm"
pnpm add @monicon/core @monicon/rollup
```
```bash tab="yarn"
yarn add @monicon/core @monicon/rollup
```
```bash tab="bun"
bun add @monicon/core @monicon/rollup
```
## Configuration
### 1. Create Monicon Config
Create a `monicon.config.js` file in your project root:
```js twoslash title="monicon.config.js"
const { react, clean } = require("@monicon/core/plugins");
module.exports = {
// Loads individual icons by icon name
icons: ["mdi:home", "feather:activity"],
// Loads all icons from the lucide collection
collections: ["lucide"],
plugins: [
/**
* change the output path to your project config for example;
* - src/components/icons
* - components/icons
*/
clean({ patterns: ["src/components/icons"] }),
react({ outputPath: "src/components/icons", format: "jsx" }),
],
};
```
### 2. Configure Rollup
Add the Monicon plugin to your `rollup.config.mjs`:
```js twoslash title="rollup.config.mjs"
import monicon from "@monicon/rollup";
export default {
// ... your rollup config
plugins: [
// ... other plugins
monicon(),
],
};
```
## Usage
After configuration, Monicon will automatically generate React components for your icons. You can import and use them in your components:
```jsx title="src/App.jsx"
import React from "react";
import BadgeCheckIcon from "./components/icons/lucide/badge-check";
import CloudDownloadIcon from "./components/icons/lucide/cloud-download";
import HomeIcon from "./components/icons/mdi/home";
import ActivityIcon from "./components/icons/feather/activity";
const App = () => {
return (
{/* If you don't want to use the className prop, you can use the svg props */}
);
};
export default App;
```
================================================
FILE: apps/docs/content/docs/installation/rspack.mdx
================================================
---
title: React (Rspack)
description: Learn how to install and use Monicon in your React (Rspack) project
---
## Installation
Install Monicon and its Rspack plugin in your project:
```bash tab="npm"
npm install @monicon/core @monicon/rspack
```
```bash tab="pnpm"
pnpm add @monicon/core @monicon/rspack
```
```bash tab="yarn"
yarn add @monicon/core @monicon/rspack
```
```bash tab="bun"
bun add @monicon/core @monicon/rspack
```
## Configuration
### 1. Create Monicon Config
Create a `monicon.config.mjs` file in your project root:
```js twoslash title="monicon.config.mjs"
import { react, clean } from "@monicon/core/plugins";
export default {
// Loads individual icons by icon name
icons: ["mdi:home", "feather:activity"],
// Loads all icons from the lucide collection
collections: ["lucide"],
plugins: [
/**
* change the output path to your project config for example;
* - src/components/icons
* - components/icons
*/
clean({ patterns: ["src/components/icons"] }),
react({ outputPath: "src/components/icons", format: "jsx" }),
],
};
```
### 2. Configure Rspack
Add the Monicon plugin to your `rspack.config.mjs`:
```js title="rspack.config.mjs"
import { defineConfig } from "@rspack/cli";
import { rspack } from "@rspack/core";
import MoniconPlugin from "@monicon/rspack";
export default defineConfig({
// ... your rspack config
plugins: [
// ... other plugins
new MoniconPlugin(),
],
});
```
## Usage
After configuration, Monicon will automatically generate React components for your icons. You can import and use them in your components:
```jsx title="src/App.jsx"
import React from "react";
import BadgeCheckIcon from "./components/icons/lucide/badge-check";
import CloudDownloadIcon from "./components/icons/lucide/cloud-download";
import HomeIcon from "./components/icons/mdi/home";
import ActivityIcon from "./components/icons/feather/activity";
const App = () => {
return (
{/* If you don't want to use the className prop, you can use the svg props */}
);
};
export default App;
```
================================================
FILE: apps/docs/content/docs/installation/svelte.mdx
================================================
---
title: Svelte
description: Learn how to install and use Monicon in your Svelte (SvelteKit) project
---
## Installation
Install Monicon and its Vite plugin in your Svelte project:
```bash tab="npm"
npm install @monicon/core @monicon/vite
```
```bash tab="pnpm"
pnpm add @monicon/core @monicon/vite
```
```bash tab="yarn"
yarn add @monicon/core @monicon/vite
```
```bash tab="bun"
bun add @monicon/core @monicon/vite
```
## Configuration
### 1. Create Monicon Config
Create a `monicon.config.ts` file in your project root:
```ts twoslash title="monicon.config.ts"
import { svelte, clean } from "@monicon/core/plugins";
import { MoniconConfig } from "@monicon/core";
export default {
// Loads individual icons by icon name
icons: ["mdi:home", "feather:activity"],
// Loads all icons from the lucide collection
collections: ["lucide"],
plugins: [
/**
* change the output path to your project config for example;
* - src/lib/components/icons
* - src/components/icons
*/
clean({ patterns: ["src/lib/components/icons"] }),
svelte({ outputPath: "src/lib/components/icons" }),
],
} satisfies MoniconConfig;
```
### 2. Configure Vite
Add the Monicon plugin to your `vite.config.ts`:
```ts twoslash title="vite.config.ts"
import { defineConfig } from "vite";
import { monicon } from "@monicon/vite";
export default defineConfig({
plugins: [
// ... other plugins
monicon(),
],
});
```
## Usage
After configuration, Monicon will automatically generate Svelte components for your icons. You can import and use them in your routes and components:
```svelte title="src/routes/+page.svelte"
```
================================================
FILE: apps/docs/content/docs/installation/universal-build-tool.mdx
================================================
---
title: Universal Build Tool
description: Learn how to use Monicon in universal build tools projects like Swift, Kotlin, etc.
---
Monicon can generate SVG icons for any project, regardless of the programming language. This guide shows you how to use Monicon as a build step to generate icon files that can be used in Swift, Kotlin, etc.
## Installation
Install the Monicon Core
```bash tab="npm"
npm install @monicon/core tsx -g
```
```bash tab="pnpm"
pnpm add @monicon/core tsx -g
```
```bash tab="yarn"
yarn global add @monicon/core tsx
```
```bash tab="bun"
bun add @monicon/core tsx -g
```
## Usage
Create a `generate-icons.js` file to generate icons:
```js title="generate-icons.js"
import { bootstrap } from "@monicon/core";
import { svg, clean } from "@monicon/core/plugins";
await bootstrap({
// Loads individual icons by icon name
icons: ["mdi:home", "feather:activity"],
// Loads all icons from a collection
collections: ["lucide"],
plugins: [
clean({ patterns: ["assets/icons"] }),
svg({ outputPath: "assets/icons" }),
],
watch: false,
});
```
## Using a Config File (Optional)
If you prefer to use a separate config file (useful for watch mode), create a `monicon.config.js` file:
```js title="monicon.config.js"
import { svg, clean } from "@monicon/core/plugins";
export default {
icons: ["mdi:home", "feather:activity"],
collections: ["lucide"],
plugins: [
clean({ patterns: ["assets/icons"] }),
svg({ outputPath: "assets/icons" }),
],
watch: true,
};
```
Then your build script can simply call `bootstrap()`:
```js twoslash title="generate-icons.js"
import { bootstrap } from "@monicon/core";
bootstrap();
```
## Running the Build
Run the build script to generate SVG files:
```bash
tsx generate-icons.js
```
This will generate SVG files in the configured output path (`assets/icons` in the example above).
## Example Output
After running the build script, you'll have SVG files in your output directory:
```
assets/icons/
├── mdi/
│ └── home.svg
├── feather/
│ └── activity.svg
└── lucide/
└── badge-check.svg
└── cloud-download.svg
└── ...
```
================================================
FILE: apps/docs/content/docs/installation/vue.mdx
================================================
---
title: Vue
description: Learn how to install and use Monicon in your Vue (Vite) project
---
## Installation
Install Monicon and its Vite plugin in your Vue project:
```bash tab="npm"
npm install @monicon/core @monicon/vite
```
```bash tab="pnpm"
pnpm add @monicon/core @monicon/vite
```
```bash tab="yarn"
yarn add @monicon/core @monicon/vite
```
```bash tab="bun"
bun add @monicon/core @monicon/vite
```
## Configuration
### 1. Create Monicon Config
Create a `monicon.config.ts` file in your project root:
```ts twoslash title="monicon.config.ts"
import { vue, clean } from "@monicon/core/plugins";
import { MoniconConfig } from "@monicon/core";
export default {
// Loads individual icons by icon name
icons: ["mdi:home", "feather:activity"],
// Loads all icons from the lucide collection
collections: ["lucide"],
plugins: [
/**
* change the output path to your project config for example;
* - src/components/icons
* - components/icons
*/
clean({ patterns: ["src/components/icons"] }),
vue({ outputPath: "src/components/icons" }),
],
} satisfies MoniconConfig;
```
### 2. Configure Vite
Add the Monicon plugin to your `vite.config.ts`:
```ts twoslash title="vite.config.ts"
import { defineConfig } from "vite";
import monicon from "@monicon/vite";
export default defineConfig({
plugins: [
// ... other plugins
monicon(),
],
});
```
## Usage
After configuration, Monicon will automatically generate Vue components for your icons. You can import and use them in your components:
```vue title="src/App.vue"
```
================================================
FILE: apps/docs/content/docs/installation/webpack.mdx
================================================
---
title: React (Webpack)
description: Learn how to install and use Monicon in your React (Webpack) project
---
## Installation
Install Monicon and its Webpack plugin in your project:
```bash tab="npm"
npm install @monicon/core @monicon/webpack
```
```bash tab="pnpm"
pnpm add @monicon/core @monicon/webpack
```
```bash tab="yarn"
yarn add @monicon/core @monicon/webpack
```
```bash tab="bun"
bun add @monicon/core @monicon/webpack
```
## Configuration
### 1. Create Monicon Config
Create a `monicon.config.js` file in your project root:
```ts twoslash title="monicon.config.js"
import { react, clean } from "@monicon/core/plugins";
import { MoniconConfig } from "@monicon/core";
export default {
// Loads individual icons by icon name
icons: ["mdi:home", "feather:activity"],
// Loads all icons from the lucide collection
collections: ["lucide"],
plugins: [
/**
* change the output path to your project config for example;
* - src/components/icons
* - components/icons
*/
clean({ patterns: ["src/components/icons"] }),
react({ outputPath: "src/components/icons", format: "jsx" }),
],
} satisfies MoniconConfig;
```
### 2. Configure Webpack
Add the Monicon plugin to your `webpack.config.js`:
```js title="webpack.config.js"
const { MoniconPlugin } = require("@monicon/webpack");
module.exports = {
// ... your webpack config
plugins: [
new MoniconPlugin({ watch: process.env.NODE_ENV === "development" }),
// ... other plugins
],
};
```
The `watch: true` option enables automatic icon regeneration during
development when your config changes.
## Usage
After configuration, Monicon will automatically generate React components for your icons. You can import and use them in your components:
```jsx title="src/App.jsx"
import BadgeCheckIcon from "./components/icons/lucide/badge-check";
import CloudDownloadIcon from "./components/icons/lucide/cloud-download";
import HomeIcon from "./components/icons/mdi/home";
import ActivityIcon from "./components/icons/feather/activity";
export default function App() {
return (
{/* If you don't want to use the className prop, you can use the svg props */}
);
}
```
================================================
FILE: apps/docs/content/docs/loaders/custom-loader.mdx
================================================
---
title: Custom Loader
description: Create your own custom icon loader
---
Custom loaders in Monicon allow you to define your own logic for providing SVG icons. This is especially useful when you want to generate icons dynamically, transform existing icons, or load them from a non-standard source.
## Creating a Custom Loader
A custom loader is a function that returns an async function which returns an object mapping icon names to SVG strings:
```ts twoslash title="loaders/custom.ts"
import { MoniconConfig } from "@monicon/core";
import { react, clean } from "@monicon/core/plugins";
import { Loader } from "@monicon/core/loaders";
export const customLoader: Loader = () => async () => {
// your custom logic here
return {
heart:
'',
};
};
export default {
icons: ["mdi:home"],
loaders: {
custom: customLoader(),
},
plugins: [
clean({ patterns: ["src/components/icons"] }),
react({ outputPath: "src/components/icons" }),
],
} satisfies MoniconConfig;
```
## Usage
After configuration, Monicon will generate components for your custom icons:
```tsx title="src/App.tsx"
import StarIcon from "./components/icons/custom/star";
import HeartIcon from "./components/icons/custom/heart";
function App() {
return (
);
}
export default App;
```
================================================
FILE: apps/docs/content/docs/loaders/json-collections.mdx
================================================
---
title: JSON Collections
description: Load icons from JSON files or URLs
---
JSON Collections in Monicon allow you to define custom icons from JSON files or URLs. These JSON files map icon names to their corresponding SVG data, making it easy to include and manage custom icon sets in your project.
## Configuration
Add the JSON collection loader to your `monicon.config.ts`:
```ts twoslash title="monicon.config.ts"
import { react, clean } from "@monicon/core/plugins";
import { loadJSONCollection } from "@monicon/core/loaders";
import { MoniconConfig } from "@monicon/core";
export default {
icons: ["mdi:home"],
loaders: {
json: loadJSONCollection(
"https://gist.githubusercontent.com/oktaysenkan/39681ecdb066dc44c52fa840dacc7562/raw/6aa7b8f8bf9d806742be0e1c4759809391d00bcd/icons.json"
),
},
plugins: [
clean({ patterns: ["src/components/icons"] }),
react({ outputPath: "src/components/icons" }),
],
} satisfies MoniconConfig;
```
## JSON File Format
The JSON file should map icon names to their corresponding SVG markup:
```json title="icons.json"
{
"network": "",
"user": ""
}
```
## Usage
After configuration, Monicon will generate components for your JSON icons. You can import and use them in your components:
```tsx title="src/App.tsx"
import NetworkIcon from "./components/icons/json/network";
import UserIcon from "./components/icons/json/user";
function App() {
return (
);
}
export default App;
```
## Use Cases
JSON collections are particularly useful for:
- Sharing icon sets across multiple projects
- Loading icons from a CMS or API
- Versioning and managing icon sets centrally
- Quick prototyping with hosted icon sets
================================================
FILE: apps/docs/content/docs/loaders/local-collections.mdx
================================================
---
title: Local Collections
description: Load icons from your local file system
---
Local Collections in Monicon allow you to use icons stored locally on your file system. These collections can be loaded using the `loadLocalCollection` function, which points to the directory containing your SVG files. This setup is ideal for projects where icons are managed locally, providing a quick and flexible way to integrate custom icon sets.
## Configuration
Add the local collection loader to your `monicon.config.ts`:
```ts twoslash title="monicon.config.ts"
import { react, clean } from "@monicon/core/plugins";
import { loadLocalCollection } from "@monicon/core/loaders";
import { MoniconConfig } from "@monicon/core";
export default {
icons: ["mdi:home"],
loaders: {
local: loadLocalCollection("assets/icons"),
},
plugins: [
clean({ patterns: ["src/components/icons"] }),
react({ outputPath: "src/components/icons" }),
],
} satisfies MoniconConfig;
```
## Directory Structure
For the above configuration, your `assets/icons` directory might look like this:
```
assets/
└── icons/
├── folder.svg
├── user.svg
└── network.svg
```
Each SVG file in the directory is automatically assigned a name based on its filename (e.g., `folder` for `folder.svg`).
## Usage
After configuration, Monicon will generate components for your local icons. You can import and use them in your components:
```tsx title="src/App.tsx"
import FolderIcon from "./components/icons/local/folder";
import UserIcon from "./components/icons/local/user";
import NetworkIcon from "./components/icons/local/network";
function App() {
return (
);
}
export default App;
```
## Nested Directories
You can also organize your SVG files in nested directories:
```
assets/
└── icons/
├── ui/
│ ├── button.svg
│ └── input.svg
└── social/
├── twitter.svg
└── github.svg
```
The nested structure will be preserved in the generated component paths:
```tsx
import ButtonIcon from "./components/icons/local/ui/button";
import TwitterIcon from "./components/icons/local/social/twitter";
```
================================================
FILE: apps/docs/content/docs/loaders/meta.json
================================================
{
"title": "Loaders",
"pages": [
"local-collections",
"json-collections",
"remote-collections",
"custom-loader"
]
}
================================================
FILE: apps/docs/content/docs/loaders/remote-collections.mdx
================================================
---
title: Remote Collections
description: Fetch icons directly from remote URLs
---
Remote Collections in Monicon allow you to fetch and use icons directly from remote URLs. These collections are configured using the `loadRemoteCollection` function, which maps icon names to their respective URLs. This setup is perfect for integrating third-party or dynamically fetched icons into your project.
## Configuration
Add the remote collection loader to your `monicon.config.ts`:
```ts twoslash title="monicon.config.ts"
import { react, clean } from "@monicon/core/plugins";
import { loadRemoteCollection } from "@monicon/core/loaders";
import { MoniconConfig } from "@monicon/core";
export default {
icons: ["mdi:home"],
loaders: {
remote: loadRemoteCollection({
download: "https://api.iconify.design/lucide:cloud-download.svg",
attachment: "https://api.iconify.design/ri:attachment-2.svg",
github: "https://api.iconify.design/simple-icons:github.svg",
}),
},
plugins: [
clean({ patterns: ["src/components/icons"] }),
react({ outputPath: "src/components/icons" }),
],
} satisfies MoniconConfig;
```
## Usage
After configuration, Monicon will generate components for your remote icons. You can import and use them in your components:
```tsx title="src/App.tsx"
import DownloadIcon from "./components/icons/remote/download";
import AttachmentIcon from "./components/icons/remote/attachment";
import GitHubIcon from "./components/icons/remote/github";
function App() {
return (
);
}
export default App;
```
================================================
FILE: apps/docs/content/docs/meta.json
================================================
{
"title": "Documentation",
"pages": [
"index",
"architecture",
"installation",
"loaders",
"plugins"
]
}
================================================
FILE: apps/docs/content/docs/plugins/clean.mdx
================================================
---
title: Clean
description: Clean output directories before generating icons
---
The Clean plugin removes files and directories before generating new icons. This ensures your output directory only contains the icons you've configured, without leftover files from previous runs.
## Usage
```ts twoslash title="monicon.config.ts"
import { clean } from "@monicon/core/plugins";
import { MoniconConfig } from "@monicon/core";
export default {
icons: ["mdi:home", "lucide:heart"],
plugins: [clean({ patterns: ["src/components/icons"] })],
} satisfies MoniconConfig;
```
The Clean plugin should typically be placed **before** other plugins in the
plugins array to ensure directories are cleaned before new files are
generated.
## Options
### `patterns`
An array of glob patterns to match files and directories for removal.
- **Type:** `string[]`
- **Required:** Yes
```ts twoslash
import { clean } from "@monicon/core/plugins";
clean({
patterns: [
"src/components/icons", // Remove entire directory
"components/icons/**/*.tsx", // Remove specific file types
],
});
```
### `enabled`
Enable or disable the clean plugin.
- **Type:** `boolean`
- **Default:** `true`
```ts twoslash
import { clean } from "@monicon/core/plugins";
clean({
patterns: ["src/components/icons"],
enabled: process.env.NODE_ENV === "production",
});
```
## Why Use Clean?
Without the Clean plugin, old icon files might remain in your output directory even after removing them from your configuration. This can lead to:
- **Stale files** - Icons you no longer use still exist in your codebase
- **Import errors** - Imports may resolve to old files
- **Larger builds** - Unnecessary files increase bundle size
- **Confusion** - Hard to know which icons are actually in use
## Conditional Cleaning
You can conditionally enable cleaning based on environment:
```ts title="monicon.config.ts"
import { clean } from "@monicon/core/plugins";
import { MoniconConfig } from "@monicon/core";
export default {
icons: ["mdi:home"],
plugins: [
clean({
patterns: ["src/components/icons"],
// Only clean in development
enabled: process.env.NODE_ENV !== "production",
}),
],
} satisfies MoniconConfig;
```
================================================
FILE: apps/docs/content/docs/plugins/custom.mdx
================================================
---
title: Custom Plugin
description: Build your own Monicon plugins with full control over icon processing
---
Learn how to create custom Monicon plugins to extend functionality with your own icon processing logic, custom file generation, and lifecycle hooks.
## Plugin Structure
A Monicon plugin is a function that returns another function, which receives the icon payload and returns a plugin instance with lifecycle hooks.
```ts twoslash title="my-plugin.ts"
import path from "path";
import type {
MoniconPlugin,
MoniconPluginFile,
MoniconPluginGenerateContext,
} from "@monicon/core/plugins";
type MyPluginOptions = {
outputPath?: string;
customOption?: string;
};
export const myPlugin: MoniconPlugin =
(options) => (payload) => {
return {
name: "my-custom-plugin",
generate(context: MoniconPluginGenerateContext) {
const files: MoniconPluginFile[] = [];
for (const icon of payload.icons) {
files.push({
path: path.join(options?.outputPath ?? "output", icon.name),
content: icon.svg,
});
}
return files;
},
};
};
```
## Plugin Types
Monicon provides TypeScript types to help you build type-safe plugins.
### `MoniconPlugin`
The main plugin type that defines the plugin factory function signature.
```ts twoslash
import type { MoniconPlugin } from "@monicon/core/plugins";
type Options = { prefix?: string };
const plugin: MoniconPlugin = (options) => (payload) => ({
name: "example-plugin",
generate: () => [],
});
```
### `MoniconPluginFile`
Represents a file to be generated by the plugin.
```ts twoslash
import type { MoniconPluginFile } from "@monicon/core/plugins";
const file: MoniconPluginFile = {
path: "output/icon.svg",
content: "",
};
```
### `MoniconPluginPayload`
The payload passed to the plugin containing the icons to process.
```ts twoslash
import type { Icon } from "@monicon/core";
type MoniconPluginPayload = {
icons: Icon[];
};
```
### `Icon`
The icon object containing all icon data.
```ts twoslash
type Icon = {
name: string;
svg: string;
width: number;
height: number;
};
```
## Lifecycle Hooks
Plugins can implement lifecycle hooks to execute code at different stages of the generation process.
### `generate`
**Required.** The main generation function that returns an array of files to create.
```ts twoslash
import type {
MoniconPlugin,
MoniconPluginGenerateContext,
} from "@monicon/core/plugins";
const plugin: MoniconPlugin = () => (payload) => ({
name: "my-plugin",
generate(context: MoniconPluginGenerateContext) {
console.log("Generating files for", payload.icons.length, "icons");
console.log("Config file path:", context.configFilePath);
return payload.icons.map((icon) => ({
path: `output/${icon.name}.svg`,
content: icon.svg,
}));
},
});
```
### `onPluginsLoad`
Called when all plugins are loaded. Useful for plugin initialization or validation.
```ts twoslash
import type {
MoniconPlugin,
MoniconPluginLoadContext,
} from "@monicon/core/plugins";
const plugin: MoniconPlugin = () => (payload) => ({
name: "my-plugin",
generate: () => [],
onPluginsLoad(context: MoniconPluginLoadContext) {
console.log("Loaded plugins:", context.plugins);
},
});
```
### `beforeGenerate`
Called before the `generate` function runs.
```ts twoslash
import type {
MoniconPlugin,
MoniconPluginGenerateContext,
} from "@monicon/core/plugins";
const plugin: MoniconPlugin = () => (payload) => ({
name: "my-plugin",
generate: () => [],
beforeGenerate(context: MoniconPluginGenerateContext) {
console.log("About to generate", context.icons.length, "icons");
},
});
```
### `afterGenerate`
Called after the `generate` function completes.
```ts twoslash
import type {
MoniconPlugin,
MoniconPluginGenerateContext,
} from "@monicon/core/plugins";
const plugin: MoniconPlugin = () => (payload) => ({
name: "my-plugin",
generate: () => [],
afterGenerate(context: MoniconPluginGenerateContext) {
console.log("Finished generating icons");
},
});
```
### `beforeWriteFiles`
Called before files are written to disk.
```ts twoslash
import type {
MoniconPlugin,
MoniconPluginWriteFilesContext,
} from "@monicon/core/plugins";
const plugin: MoniconPlugin = () => (payload) => ({
name: "my-plugin",
generate: () => [],
beforeWriteFiles(context: MoniconPluginWriteFilesContext) {
console.log("About to write", context.files.length, "files");
},
});
```
### `afterWriteFiles`
Called after files have been written to disk.
```ts twoslash
import type {
MoniconPlugin,
MoniconPluginWriteFilesContext,
} from "@monicon/core/plugins";
const plugin: MoniconPlugin = () => (payload) => ({
name: "my-plugin",
generate: () => [],
afterWriteFiles(context: MoniconPluginWriteFilesContext) {
console.log("Successfully wrote", context.files.length, "files");
},
});
```
## Context Objects
Each lifecycle hook receives a context object with relevant information.
### `MoniconPluginGenerateContext`
Available in `generate`, `beforeGenerate`, and `afterGenerate` hooks.
- **`icons`** - Array of icons being processed
- **`configUpdated`** - Whether the config file was updated
- **`configFilePath`** - Path to the Monicon config file
### `MoniconPluginLoadContext`
Available in `onPluginsLoad` hook.
- **`plugins`** - Array of loaded plugin names
- **`configUpdated`** - Whether the config file was updated
- **`configFilePath`** - Path to the Monicon config file
### `MoniconPluginWriteFilesContext`
Available in `beforeWriteFiles` and `afterWriteFiles` hooks.
- **`files`** - Array of files to be written or that were written
- **`configUpdated`** - Whether the config file was updated
- **`configFilePath`** - Path to the Monicon config file
## Using with Generic Plugin
For simpler use cases, you can extend the [Generic plugin](/docs/plugins/generic) instead of building from scratch:
```ts twoslash title="extended-generic-plugin.ts"
import {
generic,
GenericPluginOptions,
MoniconPlugin,
} from "@monicon/core/plugins";
type MyOptions = GenericPluginOptions<{
foo?: string;
}>;
export const myPlugin: MoniconPlugin = (options) =>
generic({
name: "my-extended-plugin",
outputPath: options?.outputPath ?? "output",
extension: "json",
content: (icon) => {
return JSON.stringify(
{
name: icon.name,
svg: icon.svg,
foo: options?.foo,
},
null,
2
);
},
});
```
================================================
FILE: apps/docs/content/docs/plugins/debugger.mdx
================================================
---
title: Debugger
description: Debug the icon generation process
---
The Debugger plugin logs information about the icon generation process, helping you understand what's happening during build time.
## Usage
```ts twoslash title="monicon.config.ts"
import { debuggerPlugin } from "@monicon/core/plugins";
import { MoniconConfig } from "@monicon/core";
export default {
icons: ["mdi:home", "lucide:heart"],
plugins: [debuggerPlugin()],
} satisfies MoniconConfig;
```
## Options
### `enabled`
Enable or disable the debugger plugin.
- **Type:** `boolean`
- **Default:** `true`
```ts twoslash
import { debuggerPlugin } from "@monicon/core/plugins";
debuggerPlugin({ enabled: false });
debuggerPlugin({ enabled: true });
```
## What It Logs
The Debugger plugin logs information at various stages of the generation process:
### On Plugins Load
Logs when all plugins are loaded.
```
[Monicon - Debugger Plugin] On plugins load 3 plugins
```
### Before Generate
Logs the number of icons about to be generated.
```
[Monicon - Debugger Plugin] Before generate 2 icons
```
### After Generate
Logs the number of icons that were generated.
```
[Monicon - Debugger Plugin] After generate 2 icons
```
### Before Write Files
Logs the number of files about to be written to disk.
```
[Monicon - Debugger Plugin] Before write files 2 files
```
### After Write Files
Logs the number of files that were written to disk.
```
[Monicon - Debugger Plugin] After write files 2 files
```
## Example Output
When running your build with the debugger plugin enabled, you'll see output like:
```bash
[Monicon - Debugger Plugin] On plugins load 3 plugins
[Monicon - Debugger Plugin] Before generate 12 icons
[Monicon - Debugger Plugin] After generate 12 icons
[Monicon - Debugger Plugin] Before write files 12 files
[Monicon - Debugger Plugin] After write files 12 files
```
## Use Cases
The Debugger plugin is useful for:
- **Development** - Understanding what's happening during icon generation
- **Debugging** - Troubleshooting issues with icon generation
- **Performance** - Monitoring how many icons and files are being processed
- **Verification** - Confirming that icons are being generated as expected
## Plugin Order
The Debugger plugin can be placed anywhere in the plugins array. It's typically placed last so it logs information about all other plugins:
```ts twoslash
import { debuggerPlugin } from "@monicon/core/plugins";
import { MoniconConfig } from "@monicon/core";
export default {
icons: ["mdi:home"],
plugins: [
debuggerPlugin(), // Last to log all plugin activity
],
} satisfies MoniconConfig;
```
================================================
FILE: apps/docs/content/docs/plugins/generic.mdx
================================================
---
title: Generic
description: Create custom icon outputs with flexible file generation
---
The Generic plugin is a flexible base plugin that allows you to create custom file outputs from your icons. You can control the file path, name, extension, and content, making it perfect for custom integrations or specialized icon formats.
## Usage
```ts twoslash title="monicon.config.ts"
import { generic } from "@monicon/core/plugins";
import { MoniconConfig } from "@monicon/core";
export default {
icons: ["mdi:home", "lucide:heart"],
plugins: [
generic({
name: "custom-plugin",
outputPath: "public/icons",
extension: "txt",
content: (icon) => `Icon: ${icon.name}\nSVG: ${icon.svg}`,
}),
],
} satisfies MoniconConfig;
```
## Options
### `name`
The name of your custom plugin instance (useful for debugging and logging).
- **Type:** `string`
- **Default:** `"monicon-generic-plugin"`
```ts twoslash
import { generic } from "@monicon/core/plugins";
generic({
name: "my-custom-icon-plugin",
content: (icon) => icon.svg,
});
```
### `outputPath`
The directory where files will be saved.
- **Type:** `string | ((icon: Icon) => string | undefined)`
- **Default:** `"src/components/icons"`
```ts twoslash
import { generic } from "@monicon/core/plugins";
// Static path
generic({
outputPath: "public/icons",
content: (icon) => icon.svg,
});
// Dynamic path based on icon
generic({
outputPath: (icon) => {
if (icon.name.startsWith("mdi:")) {
return "public/icons/mdi";
}
return "public/icons";
},
content: (icon) => icon.svg,
});
```
### `fileName`
Customize the file name for each icon.
- **Type:** `string | ((icon: Icon) => string | undefined)`
- **Default:** Slugified icon name (e.g., `mdi:home` becomes `mdi/home`)
```ts twoslash
import { generic } from "@monicon/core/plugins";
generic({
fileName: (icon) => {
// Custom file naming
return icon.name.toLowerCase().replace(":", "-");
},
content: (icon) => icon.svg,
});
```
### `extension`
Set the file extension for the generated files.
- **Type:** `string | ((icon: Icon) => string | undefined)`
- **Default:** `"svg"`
```ts twoslash
import { generic } from "@monicon/core/plugins";
// Static extension
generic({
extension: "txt",
content: (icon) => icon.svg,
});
// Dynamic extension based on icon
generic({
extension: (icon) => {
return icon.name.startsWith("mdi:") ? "xml" : "txt";
},
content: (icon) => icon.svg,
});
```
### `content`
The content to write to each file. This is a required option.
- **Type:** `string | ((icon: Icon) => string)`
- **Required:** `false`
> [!NOTE] If no content is provided, the plugin will log a warning and skip the icon.
```ts twoslash
import { generic } from "@monicon/core/plugins";
// Static content
generic({
content: "Hello World",
});
// Dynamic content based on icon
generic({
content: (icon) => {
return `Name: ${icon.name}\nSVG: ${icon.svg}`;
},
});
```
## Examples
### Create JSON Metadata Files
Generate JSON files with icon metadata:
```ts twoslash title="monicon.config.ts"
import { generic } from "@monicon/core/plugins";
import { MoniconConfig } from "@monicon/core";
export default {
icons: ["mdi:home", "lucide:heart"],
plugins: [
generic({
name: "icon-metadata",
outputPath: "public/icons/metadata",
extension: "json",
content: (icon) => {
return JSON.stringify(icon, null, 2);
},
}),
],
} satisfies MoniconConfig;
```
## Use Cases
The Generic plugin is perfect for:
- **Custom file formats** - Generate icons in formats not supported by other plugins
- **Metadata generation** - Create companion files with icon information
- **Documentation** - Generate documentation or reference files from icons
- **Testing** - Create test fixtures or sample data
- **Integration** - Build custom outputs for specific tools or frameworks
- **Logging** - Create text files that log icon information after processing
## Advanced Usage
You can use the Generic plugin to build your own specialized plugins:
```ts twoslash title="my-plugin.ts"
import {
generic,
GenericPluginOptions,
MoniconPlugin,
} from "@monicon/core/plugins";
import type { Icon } from "@monicon/core";
type MyCustomPluginOptions = GenericPluginOptions<{ foo?: string }>;
export const myCustomPlugin: MoniconPlugin = (options) =>
generic({
name: "my-custom-plugin",
afterGenerate(context) {
console.log("afterGenerate", context);
},
});
myCustomPlugin({ foo: "bar" });
```
================================================
FILE: apps/docs/content/docs/plugins/meta.json
================================================
{
"title": "Plugins",
"pages": [
"react",
"vue",
"svelte",
"qwik",
"react-native",
"svg",
"generic",
"clean",
"debugger",
"custom"
]
}
================================================
FILE: apps/docs/content/docs/plugins/qwik.mdx
================================================
---
title: Qwik
description: Generate Qwik components for your icons
---
The Qwik plugin generates Qwik components from your SVG icons.
## Usage
```ts twoslash title="monicon.config.ts"
import { qwik } from "@monicon/core/plugins";
import { MoniconConfig } from "@monicon/core";
export default {
icons: ["mdi:home", "lucide:heart"],
plugins: [
qwik({
outputPath: "src/components/icons",
suffix: "Icon",
}),
],
} satisfies MoniconConfig;
```
## Options
### `outputPath`
The directory where icon components will be generated.
- **Type:** `string | ((icon: Icon) => string | undefined)`
- **Default:** `"src/components/icons"`
```ts twoslash
import { qwik } from "@monicon/core/plugins";
// Static path
qwik({ outputPath: "src/components/icons" });
// Dynamic path based on icon
qwik({
outputPath: (icon) => {
if (icon.name.startsWith("mdi:")) {
return "src/components/icons/mdi";
}
return "src/components/icons";
},
});
```
### `componentName`
Customize the component name.
- **Type:** `(icon: Icon) => string | undefined`
- **Default:** `${icon.name}Icon`
```ts twoslash
import { qwik } from "@monicon/core/plugins";
qwik({
componentName: (icon) => {
return `Custom${icon.name}`;
},
});
```
### `fileName`
Customize the file name.
- **Type:** `(icon: Icon) => string | undefined`
- **Default:** Slugified icon name
```ts twoslash
import { qwik } from "@monicon/core/plugins";
qwik({
fileName: (icon) => {
return icon.name.toLowerCase().replace(":", "-");
},
});
```
### `prefix`
Add a prefix to component names.
- **Type:** `string | ((icon: Icon) => string | undefined)`
- **Default:** `""`
```ts twoslash
import { qwik } from "@monicon/core/plugins";
// Static prefix
qwik({ prefix: "Icon" });
// Dynamic prefix
qwik({
prefix: (icon) => {
return icon.name.startsWith("mdi:") ? "Mdi" : "";
},
});
```
### `suffix`
Add a suffix to component names.
- **Type:** `string | ((icon: Icon) => string | undefined)`
- **Default:** `"Icon"`
```ts twoslash
import { qwik } from "@monicon/core/plugins";
// Static suffix
qwik({ suffix: "Component" });
// No suffix
qwik({ suffix: "" });
```
## Generated Output
For an icon `mdi:home`, the plugin generates:
```tsx title="src/components/icons/mdi/home.tsx"
import { component$, type QwikIntrinsicElements } from "@builder.io/qwik";
const HomeIcon = component$((props: QwikIntrinsicElements["svg"]) => {
return (
);
});
export default HomeIcon;
```
## Usage in Components
```tsx title="src/routes/index.tsx"
import { component$ } from "@builder.io/qwik";
import HomeIcon from "~/components/icons/mdi/home";
import HeartIcon from "~/components/icons/lucide/heart";
export default component$(() => {
return (
);
});
```
================================================
FILE: apps/docs/content/docs/plugins/react-native.mdx
================================================
---
title: React Native
description: Generate React Native components for your icons
---
The React Native plugin generates React Native components using `react-native-svg` from your SVG icons.
## Usage
```ts twoslash title="monicon.config.ts"
import { reactNative } from "@monicon/core/plugins";
import { MoniconConfig } from "@monicon/core";
export default {
icons: ["mdi:home", "lucide:heart"],
plugins: [
reactNative({
outputPath: "components/icons",
format: "tsx",
suffix: "Icon",
}),
],
} satisfies MoniconConfig;
```
Make sure you have `react-native-svg` installed in your project.
## Options
### `outputPath`
The directory where icon components will be generated.
- **Type:** `string | ((icon: Icon) => string | undefined)`
- **Default:** `"src/components/icons"`
```ts twoslash
import { reactNative } from "@monicon/core/plugins";
// Static path
reactNative({ outputPath: "components/icons" });
// Dynamic path based on icon
reactNative({
outputPath: (icon) => {
if (icon.name.startsWith("mdi:")) {
return "components/icons/mdi";
}
return "components/icons";
},
});
```
### `format`
The output format for generated files.
- **Type:** `"jsx" | "tsx"`
- **Default:** `"tsx"`
```ts twoslash
import { reactNative } from "@monicon/core/plugins";
// Generate JSX files
reactNative({ format: "jsx" });
// Generate TSX files (default)
reactNative({ format: "tsx" });
```
### `componentName`
Customize the component name.
- **Type:** `(icon: Icon) => string | undefined`
- **Default:** `${icon.name}Icon`
```ts twoslash
import { reactNative } from "@monicon/core/plugins";
reactNative({
componentName: (icon) => {
return `Custom${icon.name}`;
},
});
```
### `fileName`
Customize the file name.
- **Type:** `(icon: Icon) => string | undefined`
- **Default:** Slugified icon name
```ts twoslash
import { reactNative } from "@monicon/core/plugins";
reactNative({
fileName: (icon) => {
return icon.name.toLowerCase().replace(":", "-");
},
});
```
### `prefix`
Add a prefix to component names.
- **Type:** `string | ((icon: Icon) => string | undefined)`
- **Default:** `""`
```ts twoslash
import { reactNative } from "@monicon/core/plugins";
// Static prefix
reactNative({ prefix: "Icon" });
```
### `suffix`
Add a suffix to component names.
- **Type:** `string | ((icon: Icon) => string | undefined)`
- **Default:** `"Icon"`
```ts twoslash
import { reactNative } from "@monicon/core/plugins";
// Static suffix
reactNative({ suffix: "Component" });
// No suffix
reactNative({ suffix: "" });
```
## Generated Output
For an icon `mdi:home`, the plugin generates:
```tsx title="components/icons/mdi/home.tsx"
import React from "react";
import { SvgXml, type SvgProps } from "react-native-svg";
const HomeIcon = (props: Omit) => {
const xml = ``;
return ;
};
export default HomeIcon;
```
## Usage in Components
```tsx title="app/(tabs)/index.tsx"
import { View, StyleSheet } from "react-native";
import HomeIcon from "@/components/icons/mdi/home";
import HeartIcon from "@/components/icons/lucide/heart";
export default function HomeScreen() {
return (
);
}
const styles = StyleSheet.create({
container: {
flex: 1,
flexDirection: "row",
alignItems: "center",
justifyContent: "center",
gap: 10,
},
});
```
================================================
FILE: apps/docs/content/docs/plugins/react.mdx
================================================
---
title: React
description: Generate React components for your icons
---
The React plugin generates React components (TSX or JSX) from your SVG icons.
## Usage
```ts twoslash title="monicon.config.ts"
import { react } from "@monicon/core/plugins";
import { MoniconConfig } from "@monicon/core";
export default {
icons: ["mdi:home", "lucide:heart"],
plugins: [
react({
outputPath: "src/components/icons",
format: "tsx",
suffix: "Icon",
}),
],
} satisfies MoniconConfig;
```
## Options
### `outputPath`
The directory where icon components will be generated.
- **Type:** `string | ((icon: Icon) => string | undefined)`
- **Default:** `"src/components/icons"`
```ts twoslash
import { react } from "@monicon/core/plugins";
// Static path
react({ outputPath: "components/icons" });
// Dynamic path based on icon
react({
outputPath: (icon) => {
if (icon.name.startsWith("mdi:")) {
return "components/icons/mdi";
}
return "components/icons";
},
});
```
### `format`
The output format for generated files.
- **Type:** `"jsx" | "tsx"`
- **Default:** `"tsx"`
```ts twoslash
import { react } from "@monicon/core/plugins";
// Generate JSX files
react({ format: "jsx" });
// Generate TSX files (default)
react({ format: "tsx" });
```
### `componentName`
Customize the component name.
- **Type:** `(icon: Icon) => string | undefined`
- **Default:** `${icon.name}Icon`
```ts twoslash
import { react } from "@monicon/core/plugins";
react({
componentName: (icon) => {
// Custom naming logic
return `Custom${icon.name}`;
},
});
```
### `fileName`
Customize the file name.
- **Type:** `(icon: Icon) => string | undefined`
- **Default:** Slugified icon name
```ts
react({
fileName: (icon) => {
// Custom file naming
return icon.name.toLowerCase().replace(":", "-");
},
});
```
### `prefix`
Add a prefix to component names.
- **Type:** `string | ((icon: Icon) => string | undefined)`
- **Default:** `""`
```ts twoslash
import { react } from "@monicon/core/plugins";
// Static prefix
react({ prefix: "Icon" });
// Dynamic prefix
react({
prefix: (icon) => {
return icon.name.startsWith("mdi:") ? "Mdi" : "";
},
});
```
### `suffix`
Add a suffix to component names.
- **Type:** `string | ((icon: Icon) => string | undefined)`
- **Default:** `"Icon"`
```ts twoslash
import { react } from "@monicon/core/plugins";
// Static suffix
react({ suffix: "Component" });
// No suffix
react({ suffix: "" });
// Dynamic suffix
react({
suffix: (icon) => {
return icon.name.includes("outline") ? "Outline" : "Icon";
},
});
```
## Generated Output
For an icon `mdi:home`, the plugin generates:
```ts title="src/components/icons/mdi/home.tsx"
const HomeIcon = (props: React.ComponentPropsWithoutRef<"svg">) => {
return (
);
};
export default HomeIcon;
```
## Usage in Components
```tsx title="src/App.tsx"
import HomeIcon from "./components/icons/mdi/home";
import HeartIcon from "./components/icons/lucide/heart";
function App() {
return (
Monicon is an easy-to-use icon orchestration tool that makes adding
icons to your projects simple. Access 200,000+ icons from popular sets
like Material Design, Feather, and Font Awesome.
Get Started
Explore Icons
🎨
}
title="200,000+ Icons"
>
Access a vast collection of icons from popular icon sets including
Material Design, Feather, Font Awesome, Lucide, and many more.
🚀
}
title="Framework Agnostic"
>
Works seamlessly with React, Vue, Svelte, Next.js, Nuxt, React
Native, and more. One configuration for all frameworks.
⚡
}
title="Type-Safe"
>
Full TypeScript support with auto-generated types for all your
icons, providing excellent developer experience.
📦
}
title="Tree-Shakeable"
>
Only bundle the icons you actually use. Monicon generates individual
icons as separate files for optimal bundle size.
🔧
}
title="Customizable"
>
Load icons from multiple sources: online collections, local files,
or custom JSON. Create your own plugin for any output format.
⚙️
}
title="Simple Configuration"
>
Configure once in monicon.config.ts and integrate with your favorite
bundler: Vite, Webpack, Rollup, esbuild, or Rspack.
How It Works
Define your configuration and select the icons you need. Monicon will
automatically generate optimized icon components tailored to your
framework.
);
}
================================================
FILE: apps/docs/src/components/ai/page-actions.tsx
================================================
'use client';
import { useMemo, useState } from 'react';
import { Check, ChevronDown, Copy, ExternalLinkIcon, MessageCircleIcon } from 'lucide-react';
import { cn } from '@/lib/cn';
import { useCopyButton } from 'fumadocs-ui/utils/use-copy-button';
import { buttonVariants } from 'fumadocs-ui/components/ui/button';
import { Popover, PopoverContent, PopoverTrigger } from 'fumadocs-ui/components/ui/popover';
const cache = new Map();
export function LLMCopyButton({
/**
* A URL to fetch the raw Markdown/MDX content of page
*/
markdownUrl,
}: {
markdownUrl: string;
}) {
const [isLoading, setLoading] = useState(false);
const [checked, onClick] = useCopyButton(async () => {
const cached = cache.get(markdownUrl);
if (cached) return navigator.clipboard.writeText(cached);
setLoading(true);
try {
await navigator.clipboard.write([
new ClipboardItem({
'text/plain': fetch(markdownUrl).then(async (res) => {
const content = await res.text();
cache.set(markdownUrl, content);
return content;
}),
}),
]);
} finally {
setLoading(false);
}
});
return (
);
}
export function ViewOptions({
markdownUrl,
githubUrl,
}: {
/**
* A URL to the raw Markdown/MDX content of page
*/
markdownUrl: string;
/**
* Source file URL on GitHub
*/
githubUrl: string;
}) {
const items = useMemo(() => {
const fullMarkdownUrl =
typeof window !== 'undefined' ? new URL(markdownUrl, window.location.origin) : 'loading';
const q = `Read ${fullMarkdownUrl}, I want to ask questions about it.`;
return [
{
title: 'Open in GitHub',
href: githubUrl,
icon: (
),
},
{
title: 'Open in Scira AI',
href: `https://scira.ai/?${new URLSearchParams({
q,
})}`,
icon: (
),
},
{
title: 'Open in ChatGPT',
href: `https://chatgpt.com/?${new URLSearchParams({
hints: 'search',
q,
})}`,
icon: (
),
},
{
title: 'Open in Claude',
href: `https://claude.ai/new?${new URLSearchParams({
q,
})}`,
icon: (
),
},
{
title: 'Open in T3 Chat',
href: `https://t3.chat/new?${new URLSearchParams({
q,
})}`,
icon: ,
},
];
}, [githubUrl, markdownUrl]);
return (
Open
{items.map((item) => (
{item.icon}
{item.title}
))}
);
}
================================================
FILE: apps/docs/src/components/mdx/mermaid.tsx
================================================
'use client';
import { use, useEffect, useId, useState } from 'react';
import { useTheme } from 'next-themes';
export function Mermaid({ chart }: { chart: string }) {
const [mounted, setMounted] = useState(false);
useEffect(() => {
setMounted(true);
}, []);
if (!mounted) return;
return ;
}
const cache = new Map>();
function cachePromise(key: string, setPromise: () => Promise): Promise {
const cached = cache.get(key);
if (cached) return cached as Promise;
const promise = setPromise();
cache.set(key, promise);
return promise;
}
function MermaidContent({ chart }: { chart: string }) {
const id = useId();
const { resolvedTheme } = useTheme();
const { default: mermaid } = use(cachePromise('mermaid', () => import('mermaid')));
mermaid.initialize({
startOnLoad: false,
securityLevel: 'loose',
fontFamily: 'inherit',
themeCSS: 'margin: 1.5rem auto 0;',
theme: resolvedTheme === 'dark' ? 'dark' : 'default',
});
const { svg, bindFunctions } = use(
cachePromise(`${chart}-${resolvedTheme}`, () => {
return mermaid.render(id, chart.replaceAll('\\n', '\n'));
}),
);
return (
{
if (container) bindFunctions?.(container);
}}
dangerouslySetInnerHTML={{ __html: svg }}
/>
);
}
================================================
FILE: apps/docs/src/lib/cn.ts
================================================
export { twMerge as cn } from 'tailwind-merge';
================================================
FILE: apps/docs/src/lib/layout.shared.tsx
================================================
import type { BaseLayoutProps } from "fumadocs-ui/layouts/shared";
import { BookIcon } from "lucide-react";
export function baseOptions(): BaseLayoutProps {
return {
nav: {
title: (
),
},
links: [
{
icon: ,
text: "v1 Documentation",
url: "https://v1.monicon.dev",
external: true,
on: "menu",
description: "Documentation for Monicon v1",
},
],
githubUrl: "https://github.com/oktaysenkan/monicon",
};
}
================================================
FILE: apps/docs/src/lib/source.ts
================================================
import { docs } from 'fumadocs-mdx:collections/server';
import { type InferPageType, loader } from 'fumadocs-core/source';
import { lucideIconsPlugin } from 'fumadocs-core/source/lucide-icons';
// See https://fumadocs.dev/docs/headless/source-api for more info
export const source = loader({
baseUrl: '/docs',
source: docs.toFumadocsSource(),
plugins: [lucideIconsPlugin()],
});
export function getPageImage(page: InferPageType) {
const segments = [...page.slugs, 'image.png'];
return {
segments,
url: `/og/docs/${segments.join('/')}`,
};
}
export async function getLLMText(page: InferPageType) {
const processed = await page.data.getText('processed');
return `# ${page.data.title}
${processed}`;
}
================================================
FILE: apps/docs/src/mdx-components.tsx
================================================
import defaultMdxComponents from "fumadocs-ui/mdx";
import type { MDXComponents } from "mdx/types";
import * as TabsComponents from "fumadocs-ui/components/tabs";
import * as CodeBlockComponents from "fumadocs-ui/components/codeblock";
import * as Twoslash from "fumadocs-twoslash/ui";
import {
createGenerator,
createFileSystemGeneratorCache,
} from "fumadocs-typescript";
import { AutoTypeTable } from "fumadocs-typescript/ui";
import { Mermaid } from "@/components/mdx/mermaid";
const generator = createGenerator({
// set a cache, necessary for serverless platform like Vercel
cache: createFileSystemGeneratorCache(".next/fumadocs-typescript"),
});
export function getMDXComponents(components?: MDXComponents): MDXComponents {
return {
...defaultMdxComponents,
...TabsComponents,
...CodeBlockComponents,
pre: ({ ref: _ref, ...props }) => (
{props.children}
),
AutoTypeTable: (props) => (
),
Mermaid,
...Twoslash,
...components,
};
}
================================================
FILE: apps/docs/tsconfig.json
================================================
{
"compilerOptions": {
"baseUrl": ".",
"target": "ESNext",
"lib": [
"dom",
"dom.iterable",
"esnext"
],
"allowJs": true,
"skipLibCheck": true,
"strict": true,
"forceConsistentCasingInFileNames": true,
"noEmit": true,
"esModuleInterop": true,
"module": "esnext",
"moduleResolution": "bundler",
"resolveJsonModule": true,
"isolatedModules": true,
"jsx": "react-jsx",
"incremental": true,
"paths": {
"@/*": [
"./src/*"
],
"fumadocs-mdx:collections/*": [
".source/*"
]
},
"plugins": [
{
"name": "next"
}
]
},
"include": [
"next-env.d.ts",
"**/*.ts",
"**/*.tsx",
".next/types/**/*.ts",
".next/dev/types/**/*.ts"
],
"exclude": [
"node_modules"
]
}
================================================
FILE: apps/legacy-docs/.gitignore
================================================
.next
node_modules
================================================
FILE: apps/legacy-docs/CHANGELOG.md
================================================
# @monicon/legacy-docs
## 2.0.8
### Patch Changes
- [`8623e16`](https://github.com/oktaysenkan/monicon/commit/8623e16e28e6a562d7a9179e4f45eedc05f0d3bf) Thanks [@oktaysenkan](https://github.com/oktaysenkan)! - update vite peer dependencies version
## 2.0.7
### Patch Changes
- [`450efa2`](https://github.com/oktaysenkan/monicon/commit/450efa221f0f33b56816d7f4c4296d637f210bc2) Thanks [@oktaysenkan](https://github.com/oktaysenkan)! - feat: use only needed loaders
## 2.0.6
### Patch Changes
- [#89](https://github.com/oktaysenkan/monicon/pull/89) [`b07677a`](https://github.com/oktaysenkan/monicon/commit/b07677a0f8ae704a439e34c0e9a824edeff328d6) Thanks [@oktaysenkan](https://github.com/oktaysenkan)! - feat: set default watch false for cli
## 2.0.5
### Patch Changes
- [#87](https://github.com/oktaysenkan/monicon/pull/87) [`a68704f`](https://github.com/oktaysenkan/monicon/commit/a68704f9fdcb9e7de679779df61a9cfe4ffb97e9) Thanks [@oktaysenkan](https://github.com/oktaysenkan)! - feat: change component name generation algorithm
## 2.0.4
### Patch Changes
- [`9a5487c`](https://github.com/oktaysenkan/monicon/commit/9a5487c3b4babbc005de3aeeb25767c9aab613f5) Thanks [@oktaysenkan](https://github.com/oktaysenkan)! - fix: sanitize component names
## 2.0.3
### Patch Changes
- [#84](https://github.com/oktaysenkan/monicon/pull/84) [`313dde7`](https://github.com/oktaysenkan/monicon/commit/313dde7a8425df79e0d42d6cbf40883d5e56da5b) Thanks [@oktaysenkan](https://github.com/oktaysenkan)! - chore: update cosmoconfig
## 2.0.2
### Patch Changes
- [#82](https://github.com/oktaysenkan/monicon/pull/82) [`6bff168`](https://github.com/oktaysenkan/monicon/commit/6bff1681f957d236f87330e276dfba3ecd88bd9e) Thanks [@oktaysenkan](https://github.com/oktaysenkan)! - refactor: add typescript config package as dev dep
## 2.0.1
### Patch Changes
- [#80](https://github.com/oktaysenkan/monicon/pull/80) [`6b083a5`](https://github.com/oktaysenkan/monicon/commit/6b083a55396c8269c831155efe0d4c427b0a8a1d) Thanks [@oktaysenkan](https://github.com/oktaysenkan)! - fix: resolve npx executable issue
## 2.0.0
### Patch Changes
- [#70](https://github.com/oktaysenkan/monicon/pull/70) [`ceeca33`](https://github.com/oktaysenkan/monicon/commit/ceeca334f2ad005206a2e7ce4b9276dcd23dbe35) Thanks [@oktaysenkan](https://github.com/oktaysenkan)! - introduce generic plugin system for creating custom icon transformations and output formats. This powerful new plugin allows unlimited extensibility - generate icons in any format beyond the built-in framework plugins by controlling file paths, names, extensions, and content generation.
================================================
FILE: apps/legacy-docs/LICENSE
================================================
MIT License
Copyright (c) 2022 Shu Ding
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
================================================
FILE: apps/legacy-docs/README.md
================================================
# Nextra Docs Template
This is a template for creating documentation with [Nextra](https://nextra.site).
[**Live Demo →**](https://nextra-docs-template.vercel.app)
[](https://nextra-docs-template.vercel.app)
## Quick Start
Click the button to clone this repository and deploy it on Vercel:
[](https://vercel.com/new/clone?s=https%3A%2F%2Fgithub.com%2Fshuding%2Fnextra-docs-template&showOptionalTeamCreation=false)
## Local Development
First, run `pnpm i` to install the dependencies.
Then, run `pnpm dev` to start the development server and visit localhost:3000.
## License
This project is licensed under the MIT License.
================================================
FILE: apps/legacy-docs/next-env.d.ts
================================================
///
///
// NOTE: This file should not be edited
// see https://nextjs.org/docs/pages/building-your-application/configuring/typescript for more information.
================================================
FILE: apps/legacy-docs/next-sitemap.config.js
================================================
/** @type {import('next-sitemap').IConfig} */
module.exports = {
siteUrl: process.env.SITE_URL || "https://monicon-docs.vercel.app",
generateRobotsTxt: true,
};
================================================
FILE: apps/legacy-docs/next.config.mjs
================================================
import nextra from "nextra";
const withNextra = nextra({
theme: "nextra-theme-docs",
themeConfig: "./theme.config.tsx",
});
export default withNextra();
================================================
FILE: apps/legacy-docs/package.json
================================================
{
"name": "@monicon/legacy-docs",
"version": "2.0.8",
"description": "Monicon V1 Documentation",
"private": true,
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start",
"postbuild": "next-sitemap"
},
"license": "MIT",
"dependencies": {
"@vercel/og": "^0.6.3",
"next": "^14.2.14",
"next-sitemap": "^4.2.3",
"nextra": "^3.0.11",
"nextra-theme-docs": "^3.0.11",
"react": "^18.2.0",
"react-dom": "^18.2.0"
},
"devDependencies": {
"@types/node": "18.11.10",
"typescript": "^4.9.3"
},
"dependenciesMeta": {
"nextra": {
"injected": true
},
"nextra-theme-docs": {
"injected": true
}
}
}
================================================
FILE: apps/legacy-docs/pages/_app.tsx
================================================
function App({ Component, pageProps }) {
return ;
}
export default App;
================================================
FILE: apps/legacy-docs/pages/_meta.tsx
================================================
export default {
index: "Introduction",
installation: "Installation",
customization: "Customization",
troubleshooting: "Troubleshooting",
contact: {
title: "Contact ↗",
type: "page",
href: "https://twitter.com/senkanoktay",
newWindow: true,
},
};
================================================
FILE: apps/legacy-docs/pages/api/og.tsx
================================================
import { NextApiRequest, NextApiResponse } from "next";
import { ImageResponse } from "@vercel/og";
export const config = {
runtime: "edge",
};
const interMedium = fetch(
new URL("../../public/Inter-Medium.ttf", import.meta.url)
).then((res) => res.arrayBuffer());
const dotPattern = `
`;
export default async function handler(
req: NextApiRequest,
res: NextApiResponse
) {
const [interMediumFont] = await Promise.all([interMedium]);
const { searchParams } = new URL(req.url || "", `http://${req.headers.host}`);
const text = searchParams.get("text") || "Monicon";
return new ImageResponse(
(
{text}
),
{
width: 1200,
height: 630,
fonts: [
{
name: "Inter",
data: interMediumFont,
style: "normal",
weight: 500,
},
],
}
);
}
================================================
FILE: apps/legacy-docs/pages/customization/_meta.tsx
================================================
export default {
"local-collections": "Local Collections",
"json-collections": "JSON Collections",
"remote-collections": "Remote Collections",
"custom-loader": "Custom Loader",
};
================================================
FILE: apps/legacy-docs/pages/customization/custom-loader.mdx
================================================
# Custom Loader
Custom loaders in Monicon allow you to define your own logic for providing SVG icons. This is especially useful when you want to generate icons dynamically or load them from a non-standard source. Below is an example of how to write and use a custom loader.
```ts
import { Loader } from "@monicon/loader";
export const fooLoader: Loader = () => async () => {
return {
bar: '',
};
};
```
```ts filename="vite.config.ts"
import { defineConfig } from "vite";
import react from "@vitejs/plugin-react";
import monicon from "@monicon/vite";
export default defineConfig({
plugins: [
react(),
monicon({
customCollections: {
foo: fooLoader(),
},
}),
],
});
```
### Usage
Once your custom loader is set up, you can use the icons it provides in your React components:
```tsx filename="src/App.tsx"
import { Monicon } from "@monicon/react";
function App() {
return (
);
}
export default App;
```
================================================
FILE: apps/legacy-docs/pages/customization/json-collections.mdx
================================================
# JSON Collections
JSON Collections in Monicon allow you to define custom icons from JSON files or URLs. These JSON files typically map icon names to their corresponding SVG data, making it easy to include and manage custom icon sets in your project. In the example above, the loadJSONCollection function fetches icons from a hosted JSON file and integrates them into your application.
```ts filename="vite.config.ts"
import { defineConfig } from "vite";
import react from "@vitejs/plugin-react";
import monicon from "@monicon/vite";
import { loadJSONCollection } from "@monicon/loader";
export default defineConfig({
plugins: [
react(),
monicon({
customCollections: {
json: loadJSONCollection(
"https://gist.githubusercontent.com/oktaysenkan/39681ecdb066dc44c52fa840dacc7562/raw/6aa7b8f8bf9d806742be0e1c4759809391d00bcd/icons.json"
),
},
}),
],
});
```
### Example JSON File
Here is an example JSON file you can use for a Monicon JSON Collection. This file maps an icon name (network) to its corresponding SVG markup:
```json filename="https://gist.githubusercontent.com/oktaysenkan/39681ecdb066dc44c52fa840dacc7562/raw/6aa7b8f8bf9d806742be0e1c4759809391d00bcd/icons.json"
{
"network": ""
}
```
### Usage
You can now use Monicon in your React components. Here’s an example of how to use Monicon in a React component.
```tsx filename="src/App.tsx"
import { Monicon } from "@monicon/react";
function App() {
return (
);
}
export default App;
```
================================================
FILE: apps/legacy-docs/pages/customization/local-collections.mdx
================================================
# Local Collections
Local Collections in Monicon allow you to use icons stored locally on your file system. These collections can be loaded using the `loadLocalCollection` function, which points to the directory containing your SVG files. This setup is ideal for projects where icons are managed locally, providing a quick and flexible way to integrate custom icon sets.
```ts filename="vite.config.ts"
import { defineConfig } from "vite";
import react from "@vitejs/plugin-react";
import monicon from "@monicon/vite";
import { loadLocalCollection } from "@monicon/loader";
export default defineConfig({
plugins: [
react(),
monicon({
customCollections: {
local: loadLocalCollection("assets/icons"),
},
}),
],
});
```
### Example Directory Structure
For the above configuration, your assets/icons directory might look like this:
```
assets/
└── icons/
├── folder.svg
├── user.svg
└── network.svg
```
Each SVG file in the directory is automatically assigned a name based on its filename (e.g., `folder` for `folder.svg`).
### Usage
You can now use Monicon in your React components. Here’s an example of how to use an icon from your local collection in a React component:
```tsx filename="src/App.tsx"
import { Monicon } from "@monicon/react";
function App() {
return (
);
}
export default App;
```
================================================
FILE: apps/legacy-docs/pages/customization/remote-collections.mdx
================================================
# Remote Collections
Remote Collections in Monicon allow you to fetch and use icons directly from remote URLs. These collections are configured using the `loadRemoteCollection` function, which maps icon names to their respective URLs. This setup is perfect for integrating third-party or dynamically fetched icons into your project.
```ts filename="vite.config.ts"
import { defineConfig } from "vite";
import react from "@vitejs/plugin-react";
import monicon from "@monicon/vite";
import { loadRemoteCollection } from "@monicon/loader";
export default defineConfig({
plugins: [
react(),
monicon({
customCollections: {
remote: loadRemoteCollection({
download: "https://api.iconify.design/lucide:cloud-download.svg",
attachment: "https://api.iconify.design/ri:attachment-2.svg",
}),
},
}),
],
});
```
### Usage
You can now use Monicon in your React components. Here’s an example of how to use icons from your remote collection in a React component:
```tsx filename="src/App.tsx"
import { Monicon } from "@monicon/react";
function App() {
return (
);
}
export default App;
```
================================================
FILE: apps/legacy-docs/pages/index.mdx
================================================
# Monicon: Universal Icon Library
Monicon is an easy-to-use icon library that makes adding icons to your projects simple. It works with popular frameworks like React, React Native, Next.js, Vue, Nuxt, Svelte and more. It's provides 200,000+ icons from popular sets like Material Design, Feather, and Font Awesome.
## Why Use Monicon?
- **Huge Icon Library**: Get access to over 200,000 icons from famous sets like Material Design, Feather, and Font Awesome.
- **Custom Icons**: You can create custom icons and use them in your projects. Monicon makes it easy to add your own icons.
- **Works with Modern Tools**: Monicon supports tools like Vite, Webpack, Rollup, and others, so it's ready for any project.
- **Fast and Efficient**: Monicon loads icons quickly to keep your project running smoothly. No flickering or lagging.
- **Easy to Use**: Works with React, Vue, Svelte, Next.js, and other popular frameworks, making icon integration simple. You can discover icons on the [Icones](https://icones.js.org/) website.
- **Customizable**: You can easily change the size, color, and other features of the icons to fit your design.
- **Collaboration**: Monicon helps you collaborate with designers to speed up the design process and get better results. [Iconify Figma Plugin](https://www.figma.com/community/plugin/735098390272716381/iconify) allows you to use icons directly in Figma.
- **Free and Open Source**: Monicon is free to use and open source, so you can use it in any project without restrictions.
No matter which framework you use, Monicon makes adding and managing icons easy. Check out the documentation to see how Monicon can help improve your next project with great-looking icons!
## Comparison: Monicon & Iconify & unplugin-icons
Monicon was created to address a critical gap in the React ecosystem: The need for a truly universal icon package that works seamlessly across both web and native platforms. While tools like unplugin-icons are great for certain use cases, they fall short in key areas that Monicon was specifically designed to solve.
Check out the issues for more details: [Universal Support #15](https://github.com/oktaysenkan/monicon/issues/15#issuecomment-2054178367)
| Feature | Monicon | @iconify/react | unplugin-icons |
| -------------------------- | --------------------------------------------------------------------------------------------- | ----------------------------------------------------------------- | ---------------------------------------------------- |
| **Icon Rendering** | Icons are bundled during build time, ensuring instant rendering with no blinking. | Icons load over HTTP, which can cause blinking during rendering. | Icons are bundled at build time, no blinking issues. |
| **Offline Support** | Fully offline-compatible, works seamlessly with PWAs, Electron apps, and native environments. | Does not work offline due to reliance on HTTP for fetching icons. | Works offline |
| **React Native Support** | Fully supports React Native, making it ideal for mobile and native projects. | No support for React Native. | No support for React Native. |
| **Modern Bundler Support** | Compatible with Metro, Vite, Webpack, Rollup, Rspack, and others. | Primarily web-focused and lacks versatility across bundlers. | No support for Metro. |
| **Custom Icon Support** | Easily create and use custom icons in your projects. | Easily create and use custom icons in your projects. | Easily create and use custom icons in your projects. |
================================================
FILE: apps/legacy-docs/pages/installation/_meta.tsx
================================================
export default {
react: "React",
nextjs: "Next.js",
remix: "Remix",
qwik: "Qwik",
"react-native": "React Native",
vue: "Vue",
nuxt: "Nuxt",
svelte: "Svelte",
"react-webpack": "React (Webpack)",
"react-rollup": "React (Rollup)",
"react-rspack": "React (Rspack)",
"react-esbuild": "React (esbuild)",
};
================================================
FILE: apps/legacy-docs/pages/installation/nextjs.mdx
================================================
import { Steps, Callout } from "nextra/components";
# Install Monicon with Next.js
Setting up Monicon with Next.js is a straightforward process. This guide will walk you through the installation and configuration steps to get started with Monicon in your Next.js project.
## Install
To get started, you’ll need to install the necessary dependencies for Monicon. In your project directory, run the following command to install the dependencies.
```sh npm2yarn
npm i @monicon/react@1 @monicon/webpack@1
```
Now you should install the development dependency `@iconify/json` for the icon sets. This package provides a comprehensive collection of icons that can be easily integrated into your project.
```sh npm2yarn
npm i -D @iconify/json
# or specific icon sets
npm i -D @iconify-json/mdi @iconify-json/feather
```
## Configure Next
If you want to use Monicon with Next.js, you’ll need to configure Next.js.
```js filename="next.config.js"
const { MoniconPlugin } = require("@monicon/webpack");
const nextConfig = {
webpack: (config) => {
config.plugins.push(
new MoniconPlugin({
icons: [
"mdi:home",
"feather:activity",
"logos:active-campaign",
"lucide:badge-check",
],
// Load all icons from the listed collections
collections: ["radix-icons"],
})
);
return config;
},
};
module.exports = nextConfig;
```
The `icons` array in the `monicon` plugin configuration specifies the icon sets you want to use in your project. You can add more icon sets as needed.
For a complete list of available icon sets, refer to the [Icones](https://icones.js.org/) website.
## Usage
You can now use Monicon in your React components. Here’s an example of how to use Monicon in a React component.
```tsx filename="src/app/page.tsx"
import { Monicon } from "@monicon/react";
function App() {
return (
);
}
export default App;
```
## Configure .gitignore
Add the following to your `.gitignore` file to prevent icons from being committed to your repository.
```
# monicon
.monicon
```
## Next Steps
You’ve successfully set up Monicon with Next.js! You can now explore more icon sets and customize your usage further.
================================================
FILE: apps/legacy-docs/pages/installation/nuxt.mdx
================================================
import { Steps, Callout } from "nextra/components";
# Install Monicon with Nuxt
Setting up Monicon with Nuxt is a straightforward process. This guide will walk you through the installation and configuration steps to get started with Monicon in your Nuxt project.
## Install
First, you’ll need to install the necessary dependencies for Monicon. In your project directory, run the following command.
```sh npm2yarn
npm i @monicon/vue@1 @monicon/nuxt@1
```
Next, install the development dependency @iconify/json for icon sets. This package provides a comprehensive collection of icons that you can easily integrate into your project.
```sh npm2yarn
npm i -D @iconify/json
# or specific icon sets
npm i -D @iconify-json/mdi @iconify-json/feather
```
## Configure Nuxt
Now that the dependencies are installed, you’ll need to configure Nuxt to use Monicon.
```ts filename="nuxt.config.ts"
export default defineNuxtConfig({
devtools: { enabled: true },
modules: ["@monicon/nuxt"],
monicon: {
icons: [
"mdi:home",
"feather:activity",
"logos:active-campaign",
"lucide:badge-check",
],
// Load all icons from the listed collections
collections: ["radix-icons"],
},
});
```
The `icons` array in the `monicon` plugin configuration specifies the icon
sets you want to use in your project. You can add more icon sets as needed.
For a complete list of available icon sets, refer to the
[Icones](https://icones.js.org/) website.
## Usage
You can now use Monicon in your Vue components. Here’s an example of how to use Monicon in a Vue component.
```vue filename="src/app.vue"
```
## Configure .gitignore
Add the following to your `.gitignore` file to prevent icons from being committed to your repository.
```
# monicon
.monicon
```
## Next Steps
You’ve successfully set up Monicon! You can now explore more icon sets and customize your usage further.
================================================
FILE: apps/legacy-docs/pages/installation/qwik.mdx
================================================
import { Steps, Callout } from "nextra/components";
# Install Monicon with Qwik
Setting up Monicon with Qwik is a straightforward process. This guide will walk you through the installation and configuration steps to get started with Monicon in your Qwik project.
## Install
To get started, you’ll need to install the necessary dependencies for Monicon. In your project directory, run the following command to install the dependencies.
```sh npm2yarn
npm i @monicon/qwik@1 @monicon/vite@1
```
Now you should install the development dependency `@iconify/json` for the icon sets. This package provides a comprehensive collection of icons that can be easily integrated into your project.
```sh npm2yarn
npm i -D @iconify/json
# or specific icon sets
npm i -D @iconify-json/mdi @iconify-json/feather
```
## Configure Vite
Now that the dependencies are installed, you’ll need to configure Vite to use Monicon.
```js filename="vite.config.ts"
import { defineConfig } from "vite";
import monicon from "@monicon/vite";
export default defineConfig({
plugins: [
monicon({
icons: [
"mdi:home",
"feather:activity",
"logos:active-campaign",
"lucide:badge-check",
],
// Load all icons from the listed collections
collections: ["radix-icons"],
}),
],
});
```
The `icons` array in the `monicon` plugin configuration specifies the icon sets you want to use in your project. You can add more icon sets as needed.
For a complete list of available icon sets, refer to the [Icones](https://icones.js.org/) website.
## Usage
You can now use Monicon in your Qwik components. Here’s an example of how to use Monicon in a Qwik component.
```tsx filename="src/routes/index.tsx"
import { component$ } from "@builder.io/qwik";
import { Monicon } from "@monicon/qwik";
export default component$(() => {
return (
);
}
```
## Configure .gitignore
Add the following to your `.gitignore` file to prevent icons from being committed to your repository.
```
# monicon
.monicon
```
## Next Steps
You’ve successfully set up Monicon with Qwik! You can now explore more icon sets and customize your usage further.
================================================
FILE: apps/legacy-docs/pages/installation/react-esbuild.mdx
================================================
import { Steps, Callout } from "nextra/components";
# Install Monicon with React (esbuild)
Setting up Monicon with React and esbuild is a straightforward process. This guide will walk you through the installation and configuration steps to get started with Monicon in your React project using esbuild as the bundler.
## Install
To get started, you'll need to install the necessary dependencies for Monicon. In your project directory, run the following command to install the dependencies.
```sh npm2yarn
npm i @monicon/react@1 @monicon/esbuild@1
```
Now you should install the development dependency `@iconify/json` for the icon sets. This package provides a comprehensive collection of icons that can be easily integrated into your project.
```sh npm2yarn
npm i -D @iconify/json
# or specific icon sets
npm i -D @iconify-json/mdi @iconify-json/feather
```
## Configure esbuild
Now that the dependencies are installed, you'll need to configure esbuild to use Monicon. Create a build script that uses the Monicon esbuild plugin:
```ts filename="build.ts"
import * as esbuild from "esbuild";
import monicon from "@monicon/esbuild";
await esbuild.build({
plugins: [
monicon({
icons: [
"mdi:home",
"feather:activity",
"logos:active-campaign",
"lucide:badge-check",
],
// Load all icons from the listed collections
collections: ["radix-icons"],
}),
],
});
```
The `icons` array in the `moniconPlugin` configuration specifies the icon sets you want to use in your project. You can add more icon sets as needed.
For a complete list of available icon sets, refer to the [Icones](https://icones.js.org/) website.
## Usage
You can now use Monicon in your React components. Here's an example of how to use Monicon in a React component:
```tsx filename="src/App.tsx"
import { Monicon } from "@monicon/react";
function App() {
return (
);
}
export default App;
```
## Configure .gitignore
Add the following to your `.gitignore` file to prevent icons from being committed to your repository:
```
# monicon
.monicon
```
## Next Steps
You've successfully set up Monicon with React and esbuild! You can now explore more icon sets and customize your usage further.
================================================
FILE: apps/legacy-docs/pages/installation/react-native.mdx
================================================
import { Steps, Callout } from "nextra/components";
# Install Monicon with React Native
Setting up Monicon with React Native is a straightforward process. This guide will walk you through the installation and configuration steps to get started with Monicon in your React Native project.
## Install
To get started, you’ll need to install the necessary dependencies for Monicon. In your project directory, run the following command to install the dependencies.
```sh npm2yarn
npm i @monicon/native@1 @monicon/metro@1 react-native-svg
# if you want react-native-web support
npm i @monicon/webpack@1
```
Now you should install the development dependency `@iconify/json` for the icon sets. This package provides a comprehensive collection of icons that can be easily integrated into your project.
```sh npm2yarn
npm i -D @iconify/json
# or specific icon sets
npm i -D @iconify-json/mdi @iconify-json/feather
```
## Configure Metro
Now that the dependencies are installed, you’ll need to configure Metro to use Monicon.
```js filename="metro.config.js"
const { getDefaultConfig } = require("expo/metro-config");
const { withMonicon } = require("@monicon/metro");
const config = getDefaultConfig(__dirname);
const configWithMonicon = withMonicon(config, {
icons: [
"mdi:home",
"feather:activity",
"logos:active-campaign",
"lucide:badge-check",
],
// Load all icons from the listed collections
collections: ["radix-icons"],
});
module.exports = configWithMonicon;
```
The `icons` array in the `monicon` plugin configuration specifies the icon sets you want to use in your project. You can add more icon sets as needed.
For a complete list of available icon sets, refer to the [Icones](https://icones.js.org/) website.
## Configure Webpack (Optional)
If you are using Expo Router, skip this step.
If you want to use Monicon with React Native Web, you’ll need to configure Webpack.
```js filename="webpack.config.js"
const createExpoWebpackConfigAsync = require("@expo/webpack-config");
const { MoniconPlugin } = require("@monicon/webpack");
module.exports = async function (env, argv) {
const config = await createExpoWebpackConfigAsync(env, argv);
config.plugins.push(
new MoniconPlugin({
icons: [
"mdi:home",
"feather:activity",
"logos:active-campaign",
"lucide:badge-check",
],
// Load all icons from the listed collections
collections: ["radix-icons"],
})
);
return config;
};
```
For **bare React Native** projects, you can use the `@monicon/webpack` plugin to configure Webpack.
```js filename="webpack.config.js"
module.exports = {
plugins: [
new MoniconPlugin({
icons: [
"mdi:home",
"feather:activity",
"logos:active-campaign",
"lucide:badge-check",
],
// Load all icons from the listed collections
collections: ["radix-icons"],
}),
],
};
```
## Usage
You can now use Monicon in your React components. Here’s an example of how to use Monicon in a React component.
```tsx filename="src/App.tsx"
import { View } from "react-native";
import { Monicon } from "@monicon/native";
function App() {
return (
);
}
export default App;
```
## Configure .gitignore
Add the following to your `.gitignore` file to prevent icons from being committed to your repository.
```
# monicon
.monicon
```
## Next Steps
You’ve successfully set up Monicon with React Native! You can now explore more icon sets and customize your usage further.
================================================
FILE: apps/legacy-docs/pages/installation/react-rollup.mdx
================================================
import { Steps, Callout } from "nextra/components";
# Install Monicon with React (Rollup)
Setting up Monicon with React and Rollup is a straightforward process. This guide will walk you through the installation and configuration steps to get started with Monicon in your React project.
## Install
To get started, you’ll need to install the necessary dependencies for Monicon. In your project directory, run the following command to install the dependencies.
```sh npm2yarn
npm i @monicon/react@1 @monicon/rollup@1
```
Now you should install the development dependency `@iconify/json` for the icon sets. This package provides a comprehensive collection of icons that can be easily integrated into your project.
```sh npm2yarn
npm i -D @iconify/json
# or specific icon sets
npm i -D @iconify-json/mdi @iconify-json/feather
```
## Configure Rollup
Now that the dependencies are installed, you’ll need to configure Rollup to use Monicon.
```ts filename="rollup.config.mjs"
import monicon from "@monicon/rollup";
export default {
plugins: [
monicon({
icons: [
"mdi:home",
"feather:activity",
"logos:active-campaign",
"lucide:badge-check",
],
// Load all icons from the listed collections
collections: ["radix-icons"],
}),
],
};
```
The `icons` array in the `monicon` plugin configuration specifies the icon sets you want to use in your project. You can add more icon sets as needed.
For a complete list of available icon sets, refer to the [Icones](https://icones.js.org/) website.
## Usage
You can now use Monicon in your React components. Here’s an example of how to use Monicon in a React component.
```tsx filename="src/App.tsx"
import { Monicon } from "@monicon/react";
function App() {
return (
);
}
export default App;
```
## Configure .gitignore
Add the following to your `.gitignore` file to prevent icons from being committed to your repository.
```
# monicon
.monicon
```
## Next Steps
You’ve successfully set up Monicon with React and Rollup! You can now explore more icon sets and customize your usage further.
================================================
FILE: apps/legacy-docs/pages/installation/react-rspack.mdx
================================================
import { Steps, Callout } from "nextra/components";
# Install Monicon with React (Rspack)
Setting up Monicon with React and Rspack is a straightforward process. This guide will walk you through the installation and configuration steps to get started with Monicon in your React project.
## Install
To get started, you’ll need to install the necessary dependencies for Monicon. In your project directory, run the following command to install the dependencies.
```sh npm2yarn
npm i @monicon/react@1 @monicon/rspack@1
```
Now you should install the development dependency `@iconify/json` for the icon sets. This package provides a comprehensive collection of icons that can be easily integrated into your project.
```sh npm2yarn
npm i -D @iconify/json
# or specific icon sets
npm i -D @iconify-json/mdi @iconify-json/feather
```
## Configure Rspack
Now that the dependencies are installed, you’ll need to configure Rollup to use Monicon.
```ts filename="rspack.config.mjs"
import { defineConfig } from "@rspack/cli";
import MoniconPlugin from "@monicon/rspack";
export default defineConfig({
plugins: [
new MoniconPlugin({
icons: [
"mdi:home",
"feather:activity",
"logos:active-campaign",
"lucide:badge-check",
],
// Load all icons from the listed collections
collections: ["radix-icons"],
}),
],
});
```
The `icons` array in the `monicon` plugin configuration specifies the icon sets you want to use in your project. You can add more icon sets as needed.
For a complete list of available icon sets, refer to the [Icones](https://icones.js.org/) website.
## Usage
You can now use Monicon in your React components. Here’s an example of how to use Monicon in a React component.
```tsx filename="src/App.tsx"
import { Monicon } from "@monicon/react";
function App() {
return (
);
}
export default App;
```
## Configure .gitignore
Add the following to your `.gitignore` file to prevent icons from being committed to your repository.
```
# monicon
.monicon
```
## Next Steps
You’ve successfully set up Monicon with React and Rspack! You can now explore more icon sets and customize your usage further.
================================================
FILE: apps/legacy-docs/pages/installation/react-webpack.mdx
================================================
import { Steps, Callout } from "nextra/components";
# Install Monicon with React (Webpack)
Setting up Monicon with React and Webpack is a straightforward process. This guide will walk you through the installation and configuration steps to get started with Monicon in your React project.
## Install
To get started, you’ll need to install the necessary dependencies for Monicon. In your project directory, run the following command to install the dependencies.
```sh npm2yarn
npm i @monicon/react@1 @monicon/webpack@1
```
Now you should install the development dependency `@iconify/json` for the icon sets. This package provides a comprehensive collection of icons that can be easily integrated into your project.
```sh npm2yarn
npm i -D @iconify/json
# or specific icon sets
npm i -D @iconify-json/mdi @iconify-json/feather
```
## Configure Webpack
Now that the dependencies are installed, you’ll need to configure Webpack to use Monicon.
```js filename="webpack.config.js"
module.exports = {
plugins: [
new MoniconPlugin({
icons: [
"mdi:home",
"feather:activity",
"logos:active-campaign",
"lucide:badge-check",
],
// Load all icons from the listed collections
collections: ["radix-icons"],
}),
],
};
```
The `icons` array in the `monicon` plugin configuration specifies the icon sets you want to use in your project. You can add more icon sets as needed.
For a complete list of available icon sets, refer to the [Icones](https://icones.js.org/) website.
## Usage
You can now use Monicon in your React components. Here’s an example of how to use Monicon in a React component.
```tsx filename="src/App.tsx"
import { Monicon } from "@monicon/react";
function App() {
return (
);
}
export default App;
```
## Configure .gitignore
Add the following to your `.gitignore` file to prevent icons from being committed to your repository.
```
# monicon
.monicon
```
## Next Steps
You’ve successfully set up Monicon with React and Webpack! You can now explore more icon sets and customize your usage further.
================================================
FILE: apps/legacy-docs/pages/installation/react.mdx
================================================
import { Steps, Callout } from "nextra/components";
# Install Monicon with React (Vite)
Setting up Monicon with React and Vite is a straightforward process. This guide will walk you through the installation and configuration steps to get started with Monicon in your React project.
## Install
To get started, you’ll need to install the necessary dependencies for Monicon. In your project directory, run the following command to install the dependencies.
```sh npm2yarn
npm i @monicon/react@1 @monicon/vite@1
```
Now you should install the development dependency `@iconify/json` for the icon sets. This package provides a comprehensive collection of icons that can be easily integrated into your project.
```sh npm2yarn
npm i -D @iconify/json
# or specific icon sets
npm i -D @iconify-json/mdi @iconify-json/feather
```
## Configure Vite
Now that the dependencies are installed, you’ll need to configure Vite to use Monicon.
```ts filename="vite.config.ts"
import { defineConfig } from "vite";
import react from "@vitejs/plugin-react";
import monicon from "@monicon/vite";
export default defineConfig({
plugins: [
react(),
monicon({
icons: [
"mdi:home",
"feather:activity",
"logos:active-campaign",
"lucide:badge-check",
],
// Load all icons from the listed collections
collections: ["radix-icons"],
}),
],
});
```
The `icons` array in the `monicon` plugin configuration specifies the icon sets you want to use in your project. You can add more icon sets as needed.
For a complete list of available icon sets, refer to the [Icones](https://icones.js.org/) website.
## Usage
You can now use Monicon in your React components. Here’s an example of how to use Monicon in a React component.
```tsx filename="src/App.tsx"
import { Monicon } from "@monicon/react";
function App() {
return (
);
}
export default App;
```
## Configure .gitignore
Add the following to your `.gitignore` file to prevent icons from being committed to your repository.
```
# monicon
.monicon
```
## Next Steps
You’ve successfully set up Monicon with React and Vite! You can now explore more icon sets and customize your usage further.
================================================
FILE: apps/legacy-docs/pages/installation/remix.mdx
================================================
import { Steps, Callout } from "nextra/components";
# Install Monicon with Remix
Setting up Monicon with Remix and Vite is a straightforward process. This guide will walk you through the installation and configuration steps to get started with Monicon in your Remix project.
## Install
To get started, you’ll need to install the necessary dependencies for Monicon. In your project directory, run the following command to install the dependencies.
```sh npm2yarn
npm i @monicon/react@1 @monicon/vite@1
```
Now you should install the development dependency `@iconify/json` for the icon sets. This package provides a comprehensive collection of icons that can be easily integrated into your project.
```sh npm2yarn
npm i -D @iconify/json
# or specific icon sets
npm i -D @iconify-json/mdi @iconify-json/feather
```
## Configure Vite
Now that the dependencies are installed, you’ll need to configure Vite to use Monicon.
```ts filename="vite.config.ts"
import { vitePlugin as remix } from "@remix-run/dev";
import { defineConfig } from "vite";
import monicon from "@monicon/vite";
export default defineConfig({
plugins: [
remix(),
monicon({
icons: [
"mdi:home",
"feather:activity",
"logos:active-campaign",
"lucide:badge-check",
],
// Load all icons from the listed collections
collections: ["radix-icons"],
}),
],
});
```
The `icons` array in the `monicon` plugin configuration specifies the icon sets you want to use in your project. You can add more icon sets as needed.
For a complete list of available icon sets, refer to the [Icones](https://icones.js.org/) website.
## Usage
You can now use Monicon in your React components. Here’s an example of how to use Monicon in a React component.
```tsx filename="app/routes/_index.tsx"
import { Monicon } from "@monicon/react";
function App() {
return (
);
}
export default App;
```
## Configure .gitignore
Add the following to your `.gitignore` file to prevent icons from being committed to your repository.
```
# monicon
.monicon
```
## Next Steps
You’ve successfully set up Monicon with Remix! You can now explore more icon sets and customize your usage further.
================================================
FILE: apps/legacy-docs/pages/installation/svelte.mdx
================================================
import { Steps, Callout } from "nextra/components";
# Install Monicon with Svelte
Setting up Monicon with Svelte is a straightforward process. This guide will walk you through the installation and configuration steps to get started with Monicon in your React project.
## Install
To get started, you’ll need to install the necessary dependencies for Monicon. In your project directory, run the following command to install the dependencies.
```sh npm2yarn
npm i @monicon/svelte@1 @monicon/vite@1
```
Now you should install the development dependency `@iconify/json` for the icon sets. This package provides a comprehensive collection of icons that can be easily integrated into your project.
```sh npm2yarn
npm i -D @iconify/json
# or specific icon sets
npm i -D @iconify-json/mdi @iconify-json/feather
```
## Configure Vite
Now that the dependencies are installed, you’ll need to configure Vite to use Monicon.
```tsx filename="vite.config.ts"
import { defineConfig } from "vite";
import { svelte } from "@sveltejs/vite-plugin-svelte";
import monicon from "@monicon/vite";
export default defineConfig({
plugins: [
svelte(),
monicon({
icons: [
"mdi:home",
"feather:activity",
"logos:active-campaign",
"lucide:badge-check",
],
// Load all icons from the listed collections
collections: ["radix-icons"],
}),
],
});
```
The `icons` array in the `monicon` plugin configuration specifies the icon sets you want to use in your project. You can add more icon sets as needed.
For a complete list of available icon sets, refer to the [Icones](https://icones.js.org/) website.
## Usage
You can now use Monicon in your Svelte components. Here’s an example of how to use Monicon in a Svelte component.
```svelte filename="src/App.svelte"
```
## Configure .gitignore
Add the following to your `.gitignore` file to prevent icons from being committed to your repository.
```
# monicon
.monicon
```
## Next Steps
You’ve successfully set up Monicon with Svelte! You can now explore more icon sets and customize your usage further.
================================================
FILE: apps/legacy-docs/pages/installation/vue.mdx
================================================
import { Steps, Callout } from "nextra/components";
# Install Monicon with Vue
Setting up Monicon with Vue is a straightforward process. This guide will walk you through the installation and configuration steps to get started with Monicon in your Vue project.
## Install
First, you’ll need to install the necessary dependencies for Monicon. In your project directory, run the following command.
```sh npm2yarn
npm i @monicon/vue@1 @monicon/vite@1
```
Next, install the development dependency @iconify/json for icon sets. This package provides a comprehensive collection of icons that you can easily integrate into your project.
```sh npm2yarn
npm i -D @iconify/json
# or specific icon sets
npm i -D @iconify-json/mdi @iconify-json/feather
```
## Configure Vite
Now that the dependencies are installed, you’ll need to configure Vite to use Monicon.
```ts filename="vite.config.ts"
import { defineConfig } from "vite";
import vue from "@vitejs/plugin-vue";
import monicon from "@monicon/vite";
export default defineConfig({
plugins: [
vue(),
monicon({
icons: [
"mdi:home",
"feather:activity",
"logos:active-campaign",
"lucide:badge-check",
],
// Load all icons from the listed collections
collections: ["radix-icons"],
}),
],
});
```
The `icons` array in the `monicon` plugin configuration specifies the icon
sets you want to use in your project. You can add more icon sets as needed.
For a complete list of available icon sets, refer to the
[Icones](https://icones.js.org/) website.
## Global Import (Optional)
If you want to use Monicon globally in your Vue project, add the following code to your main.ts file.
```ts filename="main.ts"
import Monicon from "@monicon/vue";
const app = createApp(App);
app.use(Monicon);
```
## Usage
You can now use Monicon in your Vue components. Here’s an example of how to use Monicon in a Vue component.
```vue filename="src/App.vue"
```
## Configure .gitignore
Add the following to your `.gitignore` file to prevent icons from being committed to your repository.
```
# monicon
.monicon
```
## Next Steps
You’ve successfully set up Monicon! You can now explore more icon sets and customize your usage further.
================================================
FILE: apps/legacy-docs/pages/troubleshooting/_meta.tsx
================================================
export default {
typescript: "TypeScript",
monorepo: "Monorepo",
"module-resolution": "Module Resolution",
"bundle-size": "Bundle Size",
};
================================================
FILE: apps/legacy-docs/pages/troubleshooting/bundle-size.mdx
================================================
import { Steps, Callout } from "nextra/components";
# Bundle Size
To keep your application efficient, it’s best to only include the icons you actually use. This guide shows how to reduce your bundle size by selecting specific icons with Monicon.
## Unoptimized Configuration
In the example below, the entire `lucide` icon collection is included, which increases the bundle size significantly.
```ts filename="vite.config.ts" {9,10}
import { defineConfig } from "vite";
import react from "@vitejs/plugin-react";
import monicon from "@monicon/vite";
export default defineConfig({
plugins: [
react(),
monicon({
icons: [],
collections: ["lucide"],
}),
],
});
```
```sh
vite v5.4.8 building for production...
dist/assets/vite-react-Ceh97ktz.js 528.50 kB │ gzip: 68.80 kB
```
## Optimized Configuration
To reduce the bundle size, specify only the icons you need by adding them to the `icons` option and leaving `collections` empty. This setup includes just `"lucide:badge-check"` and reduces the bundle size significantly.
```tsx filename="vite.config.ts" {9,10}
import { defineConfig } from "vite";
import react from "@vitejs/plugin-react";
import monicon from "@monicon/vite";
export default defineConfig({
plugins: [
react(),
monicon({
icons: ["lucide:badge-check"],
collections: [],
}),
],
});
```
```sh
vite v5.4.8 building for production...
dist/assets/vite-react-CloGAhCu.js 0.44 kB │ gzip: 0.27 kB
```
Bundle size reduced from **528.50 kB** to **0.44 kB** for the whole app.
## Conclusion
To keep your bundle size small and your application efficient:
1. Specify only the icons you need with the `icons` option.
2. Leave `collections` empty if the entire set is unnecessary.
This setup minimizes the bundle size and optimizes performance in production.
================================================
FILE: apps/legacy-docs/pages/troubleshooting/module-resolution.mdx
================================================
# Module Resolution
Here, module resolution ensures that the correct version and format of the module are loaded, making sure everything works together smoothly. You can specify different formats like "esm" for modern JavaScript or "cjs" for older CommonJS modules.
```ts filename="apps/web/vite.config.ts" copy {10}
import { defineConfig } from "vite";
import react from "@vitejs/plugin-react";
import monicon from "@monicon/vite";
export default defineConfig({
plugins: [
react(),
// The format option makes sure outfile is in ESM format
// You can also use "cjs" for CommonJS format but Vite does not support it
monicon({ format: "esm" }),
],
});
```
================================================
FILE: apps/legacy-docs/pages/troubleshooting/monorepo.mdx
================================================
# Monorepo Configuration
This monorepo configuration each app has a unique output file, so you can use Monicon in multiple apps without conflicts.
```ts filename="apps/web/vite.config.ts" copy {9}
import { defineConfig } from "vite";
import react from "@vitejs/plugin-react";
import monicon from "@monicon/vite";
export default defineConfig({
plugins: [
react(),
// The outputFileName option makes sure each app has a unique file name
monicon({ outputFileName: "web" }),
],
});
```
================================================
FILE: apps/legacy-docs/pages/troubleshooting/typescript.mdx
================================================
# TypeScript
Monicon uses TypeScript to generate types for the icons. To enable TypeScript type definitions for your icons, add the following configuration to your `tsconfig.json` file:
```json filename="tsconfig.json" copy {2}
{
"include": [".monicon/*.d.ts"]
}
```
You can also use the `typesFileName` option to specify the name of the file to output the types to. If you want to disable the types file, you can set the `generateTypes` option to `false`.
```ts filename="apps/vite-react/vite.config.ts" copy {9,10}
import { defineConfig } from "vite";
import react from "@vitejs/plugin-react";
import monicon from "@monicon/vite";
export default defineConfig({
plugins: [
react(),
monicon({
typesFileName: "types",
generateTypes: true,
}),
],
});
```
================================================
FILE: apps/legacy-docs/public/browserconfig.xml
================================================
#ffffff
================================================
FILE: apps/legacy-docs/public/manifest.json
================================================
{
"name": "Monicon",
"icons": [
{
"src": "/android-icon-36x36.png",
"sizes": "36x36",
"type": "image/png",
"density": "0.75"
},
{
"src": "/android-icon-48x48.png",
"sizes": "48x48",
"type": "image/png",
"density": "1.0"
},
{
"src": "/android-icon-72x72.png",
"sizes": "72x72",
"type": "image/png",
"density": "1.5"
},
{
"src": "/android-icon-96x96.png",
"sizes": "96x96",
"type": "image/png",
"density": "2.0"
},
{
"src": "/android-icon-144x144.png",
"sizes": "144x144",
"type": "image/png",
"density": "3.0"
},
{
"src": "/android-icon-192x192.png",
"sizes": "192x192",
"type": "image/png",
"density": "4.0"
}
]
}
================================================
FILE: apps/legacy-docs/public/robots.txt
================================================
# *
User-agent: *
Allow: /
# Host
Host: https://monicon-docs.vercel.app
# Sitemaps
Sitemap: https://monicon-docs.vercel.app/sitemap.xml
================================================
FILE: apps/legacy-docs/public/sitemap-0.xml
================================================
https://monicon-docs.vercel.app2026-01-24T12:51:07.293Zdaily0.7https://monicon-docs.vercel.app/customization/custom-loader2026-01-24T12:51:07.295Zdaily0.7https://monicon-docs.vercel.app/customization/json-collections2026-01-24T12:51:07.295Zdaily0.7https://monicon-docs.vercel.app/customization/local-collections2026-01-24T12:51:07.295Zdaily0.7https://monicon-docs.vercel.app/customization/remote-collections2026-01-24T12:51:07.295Zdaily0.7https://monicon-docs.vercel.app/installation/nextjs2026-01-24T12:51:07.295Zdaily0.7https://monicon-docs.vercel.app/installation/nuxt2026-01-24T12:51:07.295Zdaily0.7https://monicon-docs.vercel.app/installation/qwik2026-01-24T12:51:07.295Zdaily0.7https://monicon-docs.vercel.app/installation/react2026-01-24T12:51:07.295Zdaily0.7https://monicon-docs.vercel.app/installation/react-esbuild2026-01-24T12:51:07.295Zdaily0.7https://monicon-docs.vercel.app/installation/react-native2026-01-24T12:51:07.295Zdaily0.7https://monicon-docs.vercel.app/installation/react-rollup2026-01-24T12:51:07.295Zdaily0.7https://monicon-docs.vercel.app/installation/react-rspack2026-01-24T12:51:07.295Zdaily0.7https://monicon-docs.vercel.app/installation/react-webpack2026-01-24T12:51:07.295Zdaily0.7https://monicon-docs.vercel.app/installation/remix2026-01-24T12:51:07.295Zdaily0.7https://monicon-docs.vercel.app/installation/svelte2026-01-24T12:51:07.295Zdaily0.7https://monicon-docs.vercel.app/installation/vue2026-01-24T12:51:07.295Zdaily0.7https://monicon-docs.vercel.app/troubleshooting/bundle-size2026-01-24T12:51:07.295Zdaily0.7https://monicon-docs.vercel.app/troubleshooting/module-resolution2026-01-24T12:51:07.295Zdaily0.7https://monicon-docs.vercel.app/troubleshooting/monorepo2026-01-24T12:51:07.295Zdaily0.7https://monicon-docs.vercel.app/troubleshooting/typescript2026-01-24T12:51:07.295Zdaily0.7
================================================
FILE: apps/legacy-docs/public/sitemap.xml
================================================
https://monicon-docs.vercel.app/sitemap-0.xml
================================================
FILE: apps/legacy-docs/theme.config.tsx
================================================
import React from "react";
import { DocsThemeConfig, useConfig, useTheme } from "nextra-theme-docs";
import { useRouter } from "next/router";
const config: DocsThemeConfig = {
banner: {
key: "v2-release",
content: (
🎉 Monicon v2 is now available! Check out the new documentation →
),
},
head() {
const config = useConfig();
const { route } = useRouter();
const description =
config.frontMatter.description ??
"Monicon is a icon library for Modern Frameworks";
const title = config.title + (route === "/" ? "" : " - Monicon");
return (
<>
{title}
>
);
},
logo: () => {
const { resolvedTheme } = useTheme();
return (
);
},
project: {
link: "https://github.com/oktaysenkan/monicon",
},
// TODO: Change this after v2 release
docsRepositoryBase:
"https://github.com/oktaysenkan/monicon/tree/main/apps/docs",
footer: {
content: