@i316/solar-vue
v0.1.1
Published
i316: Solar icons as tree-shakeable Vue 3 components.
Maintainers
Readme
@i316/solar-vue
i316: Solar icons as Vue 3 components. 1,454 icons in 6 styles: linear (default), bold, broken, bold-duotone, line-duotone, outline.
Other i316 Solar packages: @i316/solar-react (React web), @i316/solar-react-native (React Native), @i316/solar-angular (Angular) and @i316/solar-web (plain HTML web component and raw SVGs).
npm install @i316/solar-vueUsage
<script setup lang="ts">
// One style: every icon is exported as both `Bell` and `BellIcon`.
import { AltArrowDown, BellIcon } from '@i316/solar-vue/linear';
// Any style from the root: <Name><Style>Icon, or <Name>Icon to switch style at runtime.
import { BellBoldIcon, HomeIcon } from '@i316/solar-vue';
</script>
<template>
<AltArrowDown :size="20" color="#e11d48" />
<BellBoldIcon class="text-slate-500" title="Notifications" />
<HomeIcon :variant="isActive ? 'bold' : 'linear'" />
</template>Works with server-side rendering (Nuxt, @vue/server-renderer). class, style, listeners and other attributes fall through to the root <svg>.
Defaults for a subtree
<script setup lang="ts">
import { SolarIconProvider } from '@i316/solar-vue';
</script>
<template>
<SolarIconProvider :size="20" :stroke-width="2" class-name="shrink-0">
<RouterView />
</SolarIconProvider>
</template>Props on an icon override the provider. Nested providers override their parent's values.
Icons chosen at runtime
<script setup lang="ts">
import { DynamicIcon } from '@i316/solar-vue/dynamic';
</script>
<template>
<DynamicIcon :name="item.icon" variant="bold">
<template #fallback><Spinner /></template>
</DynamicIcon>
</template>Each icon is loaded as its own chunk the first time it renders. This is opt-in: only apps that import /dynamic pay for its map of every icon name.
Tree-shaking
Every icon is its own module and the package is sideEffects-free, so Vite, webpack and Nuxt production builds ship only the icons you import. For unbundled toolchains (Jest, webpack in development), add the bundled Babel plugin, which rewrites barrel imports into per-icon imports:
// babel.config.js
module.exports = { plugins: ['@i316/solar-vue/babel'] };Props
| Prop | Default | |
|---|---|---|
| size | 24 | width and height |
| color | currentColor | icon color |
| strokeWidth | 1.5 | linear, broken, line-duotone only; ignored by the other styles |
| secondaryColor | color | color of the translucent layer, bold-duotone, line-duotone only |
| secondaryOpacity | as designed | opacity of that layer, bold-duotone, line-duotone only |
| title | none | accessible name (see below) |
| variant | linear | <Name>Icon and DynamicIcon only: which style to render |
Accessibility: icons are decorative by default (aria-hidden="true"). Pass title to make one meaningful: it renders a <title> with role="img". Passing your own aria-label or role also removes aria-hidden.
Styling: every icon has the classes solar-icon solar-icon-<name> (e.g. solar-icon-alt-arrow-down).
Editor previews: hovering an icon imported from a style path (@i316/solar-vue/linear) in VS Code shows a picture of it. Root imports have no previews, which keeps them light for the editor.
ESM only, with TypeScript declarations. Peer dependency: vue >= 3.2.
License
Icons: Solar Icon Set by 480 Design (https://github.com/480-Design/Solar-Icon-Set), licensed under CC BY 4.0. i316 modified them: recolored from the original hardcoded hex (#1C274C) to currentColor; reformatted, with some duotone groups and multi-path Bold icons consolidated into fewer paths (no intended visual change); seven icons renamed (e.g. cloud-file is now file-cloud); converted into React, React Native, Vue, Angular and web-component formats.
186 of the icons are not 480 Design's: they are Solar icon extensions by Hakim Saoudi (the @solar-icons project) (https://github.com/saoudi-h/solar-icons), licensed under MIT. LICENSE lists them, and meta.json in the web package marks them "origin": "extension".
i316 code (components, runtime, tooling): MIT, © 2026 rahil316. See LICENSE for both licenses in full.
