Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,19 @@ pnpm add @univerjs/icons
yarn add @univerjs/icons
```

For Vue 3 projects, install the Vue package:

```bash
# npm
npm install @univerjs/icons-vue

# pnpm
pnpm add @univerjs/icons-vue

# yarn
yarn add @univerjs/icons-vue
```

## Usage

Use icons just like render a React component:
Expand Down Expand Up @@ -69,6 +82,33 @@ function App() {
}
```

## Vue 3 Usage

Use icons as Vue components:

```vue
<script setup lang="ts">
import { CopyIcon } from '@univerjs/icons-vue'
</script>

<template>
<CopyIcon class="toolbar-icon" style="font-size: 20px" />
</template>
```

Vue icons follow the same sizing and color conventions:

```vue
<script setup lang="ts">
import { PaintBucketDoubleIcon, SmileDoubleIcon } from '@univerjs/icons-vue'
</script>

<template>
<SmileDoubleIcon style="color: #3526de; font-size: 48px" />
<PaintBucketDoubleIcon style="font-size: 48px" :extend="{ colorChannel1: 'red' }" />
</template>
```

### Icon source file

The icon resources provided by the designer are placed in the svg folder at the root directory. They are organized into different subdirectories to distinguish their categories.
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
]
},
"scripts": {
"build": "pnpm --filter ./packages/icons run build",
"build": "pnpm --filter ./packages/icons run build && pnpm --filter ./packages/icons-vue run build",
"dev": "pnpm build && pnpm --filter ./packages/app dev",
"format": "oxfmt .",
"format:check": "oxfmt --check .",
Expand All @@ -36,7 +36,7 @@
"@types/react": "^19.2.14",
"@types/react-dom": "^19.2.3",
"lint-staged": "^17.0.5",
"oxfmt": "^0.51.0",
"oxfmt": "^0.53.0",
"oxlint": "^1.66.0",
"simple-git-hooks": "^2.13.1",
"typescript": "^6.0.3"
Expand Down
1 change: 1 addition & 0 deletions packages/app/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
dist
12 changes: 12 additions & 0 deletions packages/app/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Univer Icons Demo</title>
</head>
<body>
<div id="app"></div>
<script type="module" src="/src/main.ts"></script>
</body>
</html>
19 changes: 19 additions & 0 deletions packages/app/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"name": "@univerjs/icons-demo",
"version": "1.4.0",
"private": true,
"type": "module",
"scripts": {
"dev": "vite --host 127.0.0.1"
},
"dependencies": {
"@univerjs/icons": "workspace:*",
"@univerjs/icons-vue": "workspace:*",
"react": "^19.2.6",
"react-dom": "^19.2.6",
"vue": "^3.5.35"
},
"devDependencies": {
"vite": "^7.2.7"
}
}
Loading
Loading