viconic-react-icons 1.0.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +71 -0
- package/index.d.ts +16 -0
- package/package.json +3 -2
package/README.md
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
# Viconic React Icons
|
|
2
|
+
|
|
3
|
+

|
|
4
|
+

|
|
5
|
+
|
|
6
|
+
The official React component wrapper for [Viconic](https://viconic.io.vn), a modern, hyper-fast, CDN-powered icon system.
|
|
7
|
+
|
|
8
|
+
`viconic-react-icons` gives you access to over 200,000+ open-source, pixel-perfect icons grouped in customizable collections. The icons are loaded dynamically from our Smart CDN at runtime, meaning your React bundle stays incredibly lightweight regardless of how many icons you use.
|
|
9
|
+
|
|
10
|
+
## Highlights
|
|
11
|
+
- ? **Zero-Bundle Bloat**: SVGs are fetched magically via our CDN and injected directly into the DOM.
|
|
12
|
+
- ?? **Fully Customizable**: Compatible with Tailwind CSS and standard inline styles. Inherits color natively via `currentColor`.
|
|
13
|
+
- ?? **Smart Caching**: LocalStorage and Memory caching so icons appear instantly on repeated renders.
|
|
14
|
+
- ?? **SSR Ready**: Fully supports Next.js, Vite, and other Server-Side Rendering frameworks.
|
|
15
|
+
- ?? **TypeScript Support**: Includes built-in types for easy autocompletion.
|
|
16
|
+
|
|
17
|
+
## Installation
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
npm install viconic-react-icons
|
|
21
|
+
# or
|
|
22
|
+
yarn add viconic-react-icons
|
|
23
|
+
# or
|
|
24
|
+
pnpm add viconic-react-icons
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## Quick Start
|
|
28
|
+
|
|
29
|
+
Import the `ViconicIcon` component and pass the unique `name` identifier corresponding to your icon of choice from [viconic.io.vn](https://viconic.io.vn).
|
|
30
|
+
|
|
31
|
+
```jsx
|
|
32
|
+
import { ViconicIcon } from "viconic-react-icons";
|
|
33
|
+
|
|
34
|
+
function App() {
|
|
35
|
+
return (
|
|
36
|
+
<div style={{ display: "flex", gap: "10px" }}>
|
|
37
|
+
{/* Basic Usage */}
|
|
38
|
+
<ViconicIcon name="h2:0" />
|
|
39
|
+
|
|
40
|
+
{/* With Tailwind CSS */}
|
|
41
|
+
<ViconicIcon name="lucide:home" className="w-8 h-8 text-blue-500" />
|
|
42
|
+
|
|
43
|
+
{/* With standard inline styles */}
|
|
44
|
+
<ViconicIcon name="fa:solid:user" style={{ fontSize: "32px", color: "green" }} />
|
|
45
|
+
</div>
|
|
46
|
+
);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export default App;
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## Props
|
|
53
|
+
|
|
54
|
+
| Prop | Type | Default | Description |
|
|
55
|
+
| ---- | ---- | ------- | ----------- |
|
|
56
|
+
| `name` | `string` | `undefined` | **Required.** The unique icon ID (e.g. `lucide:activity`, `h2:0`). |
|
|
57
|
+
| `className` | `string` | `""` | Standard CSS class names (great for Tailwind). |
|
|
58
|
+
| `style` | `React.CSSProperties` | `{}` | Inline CSS styling. |
|
|
59
|
+
| `animate` | `string` | `undefined` | Optional built-in animation keyword. |
|
|
60
|
+
| `...props` | `HTMLAttributes` | | Spread standard HTML attributes (e.g. `onClick`, `title`). |
|
|
61
|
+
|
|
62
|
+
## Architecture
|
|
63
|
+
|
|
64
|
+
This package is a React wrapper around `<viconic-icon>` Web Components. The included `copyicons-smart-loader.js` script dynamically monitors the DOM using a `MutationObserver` and rapidly replaces `<viconic-icon>` elements with actual raw `<svg>` code.
|
|
65
|
+
|
|
66
|
+
Because we fetch SVGs in parallel and cache them across user sessions, your frontend performance score will skyrocket compared to packing large icon sets directly into your JS chunks.
|
|
67
|
+
|
|
68
|
+
## License
|
|
69
|
+
|
|
70
|
+
This project is licensed under the MIT License. Icon licenses depend on the specific icon families you request.
|
|
71
|
+
|
package/index.d.ts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
|
|
3
|
+
export interface ViconicIconProps extends React.HTMLAttributes<HTMLElement> {
|
|
4
|
+
/** The unique icon ID (e.g., 'lucide:activity', 'h2:0'). Required. */
|
|
5
|
+
name: string;
|
|
6
|
+
/** Optional built-in animation keyword. */
|
|
7
|
+
animate?: string;
|
|
8
|
+
/** Standard CSS class names. */
|
|
9
|
+
className?: string;
|
|
10
|
+
/** Inline CSS styling. */
|
|
11
|
+
style?: React.CSSProperties;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export const ViconicIcon: React.FC<ViconicIconProps>;
|
|
15
|
+
export default ViconicIcon;
|
|
16
|
+
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "viconic-react-icons",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"description": "Viconic Smart Icons loader for React",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -16,5 +16,6 @@
|
|
|
16
16
|
"react"
|
|
17
17
|
],
|
|
18
18
|
"author": "Viconic Team",
|
|
19
|
-
"license": "MIT"
|
|
19
|
+
"license": "MIT",
|
|
20
|
+
"types": "index.d.ts"
|
|
20
21
|
}
|