# Global Configuration (/docs/v1/advanced/global-configuration) Use `SolarProvider` in `@solar-icons/react` to set default styles for nested icons. `SolarProvider` and the `useSolar` hook are only available in the `@solar-icons/react` package. They are not supported in `@solar-icons/react-perf`. ## Usage [#usage] Wrap your component tree with `SolarProvider` and pass the default values. Nested icons use these defaults unless you override props on the component itself. ```jsx import { SolarProvider, Home, Settings } from '@solar-icons/react' export default function App() { return ( {/* Renders size: 24, color: navy, weight: Bold */} {/* Overrides weight to Linear */} ) } ``` ### Accepted Properties [#accepted-properties] `SolarProvider` accepts the following configuration properties: {/* TODO DOCS-3: restore AutoTypeTable when the V3 props file is authored. */} {/* */} {/* */} ## Custom Configurations with `useSolar` [#custom-configurations-with-usesolar] Use the `useSolar` hook to read or update the current configuration context dynamically. ```jsx import { useSolar, Sun, Moon } from '@solar-icons/react' function ThemeToggle() { const { value, setValue } = useSolar() const toggleTheme = () => { const newWeight = value.weight === 'Bold' ? 'Linear' : 'Bold' setValue({ weight: newWeight }) } return ( ) } ``` # Server-Side Rendering (SSR) (/docs/v1/advanced/server-side-rendering) The `@solar-icons/react` package supports client-side and server-side rendering. This guide applies to `@solar-icons/react`. The `@solar-icons/react-perf` package works with SSR out of the box. ## Standard vs. SSR Entry Points [#standard-vs-ssr-entry-points] The `@solar-icons/react` package provides two entry points: 1. **`@solar-icons/react`**: Standard entry point. Uses the React Context API (`SolarProvider` and `useSolar`) to manage default styles. These components use the `"use client"` directive for compatibility with the Next.js App Router. 2. **`@solar-icons/react/ssr`**: Dedicated SSR entry point. Components do not use the React Context API and remain Server Components (no `"use client"` directive). ### Why the difference? [#why-the-difference] React Server Components cannot use the Context API. The `/ssr` entry point exports stateless components that read props directly. This keeps the server build lean and predictable. --- ## Next.js App Router Usage [#nextjs-app-router-usage] If you use `SolarProvider`, render it in a client component. For individual icons, use standard imports. To render icons as pure Server Components without client-side JavaScript, import from `/ssr`: ```jsx // Renders on the server. import { ArrowUp } from '@solar-icons/react/ssr' export default function Page() { return (

Dashboard

) } ``` ### When to use `@solar-icons/react/ssr` [#when-to-use-solar-iconsreactssr] - You render icons on the server and do not use `SolarProvider` for global styling. - You want to minimize client-side JavaScript. # Changelog (/docs/v1/community/changelog) ## React [#react] @solar-icons/react on GitHub → ### v1.1.1 [#v111] Release on GitHub → - **Fix:** fix: logout Bold icon ### v1.1.0 [#v110] Release on GitHub → - **Feature:** Fix spelling errors and rename icons across the monorepo. This includes correcting typos like Magnifer -> Magnifier and providing deprecated aliases for backwards compatibility. - **Fix:** Fix: properly generate @deprecated JSDoc for aliased icons. - **Fix:** - chore: graduation from beta to stable release ### v1.0.3 [#v103] Release on GitHub → - **Fix:** fix(react): switch to automatic JSX runtime for React 17+ compatibility ### v1.0.2 [#v102] Release on GitHub → - **Fix:** Add Next.js App Router support with "use client" directive for client components ### v1.0.1 [#v101] Release on GitHub → - **Fix:** Initial major release: Optimized React package for Solar Icons, supporting flexible imports and improved performance. ### v1.0.0 [#v100] Release on GitHub → - **Breaking:** - Initial release of the Solar icon library and supporting packages. This version marks the first major release for all packages. ## React Perf [#react-perf] @solar-icons/react-perf on GitHub → ### v2.1.1 [#v211] Release on GitHub → - **Fix:** fix: logout Bold icon ### v2.1.0 [#v210] Release on GitHub → - **Feature:** Fix spelling errors and rename icons across the monorepo. This includes correcting typos like Magnifer -> Magnifier and providing deprecated aliases for backwards compatibility. - **Fix:** Fix: properly generate deprecated aliases for JSDoc (force release). - **Fix:** Fix: properly generate @deprecated JSDoc for aliased icons and ensure they are exported. - **Fix:** - chore: graduation from beta to stable release ### v2.0.3 [#v203] Release on GitHub → - **Fix:** - Update tsdown config to generate proper lib/\* exports structure ### v2.0.2 [#v202] Release on GitHub → - **Fix:** - Refactor icon generation system with improved file structure and naming ### v2.0.1 [#v201] Release on GitHub → - **Fix:** - Optimize tree-shaking with explicit exports and unbundle build. ### v2.0.0 [#v200] Release on GitHub → - **Breaking:** - Migrate to ESM-only, remove CJS support ### v1.0.0 [#v100-1] Release on GitHub → - **Breaking:** Initial major release: Optimized React package for Solar Icons, supporting flexible imports and improved performance. ## React Native [#react-native] @solar-icons/react-native on GitHub → ### v1.1.1 [#v111-1] Release on GitHub → - **Fix:** fix: logout Bold icon ### v1.1.0 [#v110-1] Release on GitHub → - **Feature:** Fix spelling errors and rename icons across the monorepo. This includes correcting typos like Magnifer -> Magnifier and providing deprecated aliases for backwards compatibility. - **Fix:** Fix: properly generate deprecated aliases as separate files to ensure they are exported correctly. - **Fix:** - chore: graduation from beta to stable release ### v1.0.1 [#v101-1] Release on GitHub → - **Fix:** - update README ## Vue [#vue] @solar-icons/vue on GitHub → ### v1.2.1 [#v121] Release on GitHub → - **Fix:** fix: logout Bold icon ### v1.2.0 [#v120] Release on GitHub → - **Feature:** Fix spelling errors and rename icons across the monorepo. This includes correcting typos like Magnifer -> Magnifier and providing deprecated aliases for backwards compatibility. - **Fix:** Fix: properly generate deprecated aliases as separate files to ensure they are exported correctly. - **Fix:** - chore: graduation from beta to stable release ### v1.1.0 [#v110-2] Release on GitHub → - **Feature:** - Removed unused Nuxt-specific code (simplifies package) ### v1.0.0 [#v100-2] Release on GitHub → - **Breaking:** - Initial release of @solar-icons/vue package ## Nuxt [#nuxt] @solar-icons/nuxt on GitHub → ### v1.2.1 [#v121-1] Release on GitHub → - **Fix:** fix: logout Bold icon - **Fix:** - Updated dependencies []: ### v1.2.0 [#v120-1] Release on GitHub → - **Feature:** Fix spelling errors and rename icons across the monorepo. This includes correcting typos like Magnifer -> Magnifier and providing deprecated aliases for backwards compatibility. - **Fix:** - chore: graduation from beta to stable release - **Fix:** - Updated dependencies [, ]: ### v1.1.3 [#v113] Release on GitHub → - **Fix:** - Moving @solar-icons/vue from peerDependency to direct dependency simplifies installation to a single package and ensures version compatibility, following Nuxt module best practices. ### v1.1.2 [#v112] Release on GitHub → - **Fix:** - Fix runtime plugin reference after TS to JS build conversion ### v1.1.1 [#v111-2] Release on GitHub → - **Fix:** - The --stub flag was causing build issues in the prepack script. This patch removes it to ensure proper package building during prepack phase. ### v1.1.0 [#v110-3] Release on GitHub → - **Feature:** - Critical dependency bug fix ### v1.0.0 [#v100-3] Release on GitHub → - **Fix:** - Updated dependencies []: ## Svelte [#svelte] @solar-icons/svelte on GitHub → ### v1.1.1 [#v111-3] Release on GitHub → - **Fix:** fix: logout Bold icon ### v1.1.0 [#v110-4] Release on GitHub → - **Feature:** Fix spelling errors and rename icons across the monorepo. This includes correcting typos like Magnifer -> Magnifier and providing deprecated aliases for backwards compatibility. - **Fix:** Fix: properly generate deprecated aliases as separate files to ensure they are exported correctly. - **Fix:** - chore: graduation from beta to stable release ### v1.0.1 [#v101-2] Release on GitHub → - **Fix:** Fix package publication issues ## Solid [#solid] @solar-icons/solid on GitHub → ### v1.0.1 [#v101-3] Release on GitHub → - **Fix:** fix: logout Bold icon ## Angular [#angular] @solar-icons/angular on GitHub → ### v1.0.1 [#v101-4] Release on GitHub → - **Fix:** fix: logout Bold icon # Contributing (/docs/v1/community/contributing) Currently, the project is developed and maintained by a single developer. Contributions are welcome! If you wish to contribute, please follow our [contribution guidelines](https://github.com/saoudi-h/solar-icons/blob/main/CONTRIBUTING.md). # License (/docs/v1/community/license) These libraries are licensed under [MIT License](https://github.com/saoudi-h/solar-icons/blob/main/LICENSE), making them free for personal and commercial use. However, the Solar icon pack is licensed under **CC BY 4.0** by **480 Design**, which allows commercial use with attribution. Please visit the [480 Design Figma page](https://www.figma.com/community/file/1166831539721848736) to explore the original icon set or check the [LICENSE-THIRD-PARTY](https://github.com/saoudi-h/solar-icons/blob/main/LICENSE-THIRD-PARTY) file. # Choosing a Package (/docs/v1/getting-started/choosing-a-package) Some framework packages come in two variants: **Standard** and **Performance** (`-perf`). --- ## Comparison [#comparison] | Feature | Standard Package | Performance Package (`-perf`) | | ------------------------ | ---------------------------- | ------------------------------------- | | **Dynamic Styles** | ✅ Yes | ❌ No | | **Bundle Size** | Larger | ✅ Smaller | | **Global Configuration** | ✅ Yes | ❌ No | | **Primary Use Case** | Development, dynamic styling | Production, performance-critical apps | --- ## How they work [#how-they-work] - **Standard packages** bundle all six styles inside each component. You can swap styles at runtime using the `weight` prop, or configure defaults globally using a context provider. - **Performance packages** bundle only a single style per component (e.g., `HomeBold`). Unused styles are tree-shaken and excluded from the build. --- ## React Example [#react-example] - `@solar-icons/react`: Standard package. All styles available in every icon. Supports global configuration. - `@solar-icons/react-perf`: Performance package. Every icon includes a single style, minimizing bundle size. [**@solar-icons/react Docs →**](/docs/v1/packages/react) [**@solar-icons/react-perf Docs →**](/docs/v1/packages/react) # Installation (/docs/v1/getting-started/installation) Install the package for your framework. ## React [#react] Choose standard or performance-optimized components depending on your needs. ### Standard [#standard] Includes all six styles in each component. Best for dynamic style changes. ```package-install @solar-icons/react ``` ### Performance [#performance] Includes one style per component. Best for minimal bundle sizes. ```package-install @solar-icons/react-perf ``` ## Vue [#vue] Includes multi-style components, global configuration, and category imports. ```package-install @solar-icons/vue ``` ## Nuxt [#nuxt] Nuxt 3+ module with auto-import and configuration support. ```shell nuxi module add @solar-icons/nuxt ``` ## Svelte [#svelte] Svelte 5 components using runes. ```package-install @solar-icons/svelte ``` ## Solid [#solid] Lightweight SolidJS components. ```package-install @solar-icons/solid ``` ## Angular [#angular] Angular 17+ components using signals. ```package-install @solar-icons/angular ``` # Basic Usage (/docs/v1/getting-started/usage) ## Standard Package (`@solar-icons/react`) [#standard-package-solar-iconsreact] Standard package components bundle all six styles. Swap styles using the `weight` prop. ### Import and Use [#import-and-use] Import any icon directly: ```jsx import { Home } from '@solar-icons/react' export default function App() { return } ``` ### Style (Weight) [#style-weight] Use the `weight` prop to change styles. The options are: `Bold`, `Linear`, `Outline`, `BoldDuotone`, `LineDuotone`, and `Broken` (default: `Linear`). ```jsx import { Home } from '@solar-icons/react' export default function App() { return } ``` ### Props [#props] Standard components accept the following props in addition to standard HTML SVG properties: | Prop | Type | Default | Description | | ---------- | ------------------ | -------------- | -------------------------------------- | | `color` | `string` | `currentColor` | Sets the icon color. | | `size` | `string \| number` | `1em` | Sets width and height. | | `weight` | `IconWeight` | `Linear` | Sets the icon style. | | `mirrored` | `boolean` | `false` | Flips the icon horizontally if `true`. | | `alt` | `string` | `undefined` | Accessibility label. | --- ## Performance Package (`@solar-icons/react-perf`) [#performance-package-solar-iconsreact-perf] Performance package components bundle only a single style. ### Import and Use [#import-and-use-1] Import style-specific icons. The component name combines the icon name and style (e.g., `Home` + `Bold` = `HomeBold`). ```jsx import { HomeBold, HomeLinear } from '@solar-icons/react-perf' export default function App() { return (
) } ``` You can also import from style-specific entry points to use base icon names: ```jsx import { Home } from '@solar-icons/react-perf/bold' import { Settings } from '@solar-icons/react-perf/linear' export default function App() { return (
) } ``` ### Props [#props-1] These components accept a simpler set of props: | Prop | Type | Default | Description | | ---------- | ------------------ | -------------- | -------------------------------------- | | `color` | `string` | `currentColor` | Sets the icon color. | | `size` | `string \| number` | `1em` | Sets width and height. | | `mirrored` | `boolean` | `false` | Flips the icon horizontally if `true`. | | `alt` | `string` | `undefined` | Accessibility label. | # Icon Categories (/docs/v1/icon-reference/categories) Solar includes the following categories with icons available in six styles: | Category | Number of icons | | --------------- | --------------- | | arrows | 67 | | arrows-action | 58 | | astronomy | 32 | | building | 7 | | business | 19 | | call | 21 | | devices | 89 | | faces | 21 | | files | 15 | | folders | 14 | | food | 18 | | hands | 5 | | home | 35 | | it | 31 | | like | 17 | | list | 28 | | map | 37 | | medicine | 32 | | messages | 48 | | money | 35 | | nature | 9 | | notes | 23 | | notifications | 7 | | parts | 19 | | school | 29 | | search | 12 | | security | 46 | | settings | 15 | | shopping | 27 | | sports | 41 | | text-formatting | 33 | | time | 27 | | tools | 29 | | ui | 139 | | users | 22 | | video | 103 | | weather | 36 | # Solar Icons (/docs/v1) Solar provides 1,246 unique icons in six styles, giving you 7,476 variations. The library offers packages optimized for React, Vue, Svelte, Solid, and Angular. ## Features [#features] - **7,476 variations**: 1,246 unique icons across 30+ categories, each in six styles (`Bold`, `Linear`, `Outline`, `BoldDuotone`, `LineDuotone`, and `Broken`). - **Optimization choices**: Choose standard packages for dynamic style switching, or performance packages (`-perf`) for minimal bundle sizes. - **Framework support**: Native packages for React, React Native, Vue, Nuxt, Svelte 5, SolidJS, and Angular. - **SSR & Next.js ready**: Works in Server-Side Rendering (SSR) and React Server Components (RSC) environments. ## Acknowledgements [#acknowledgements] This project wraps the **Solar Icon Set** created by **480 Design** and licensed under [CC BY 4.0](https://www.figma.com/community/file/1166831539721848736). We also draw inspiration from **Phosphor Icons** and **Lucide Icons** for their clean packaging and structure. --- ## Support the Project [#support-the-project] If Solar Icons helps your project, please consider [starring the repository on GitHub](https://github.com/saoudi-h/solar-icons). Every star makes the library more visible to other developers. # Angular (/docs/v1/packages/angular) Use `@solar-icons/angular` to integrate Solar icons into Angular 17+ applications. Built with Signals and Standalone Components. ## Installation [#installation] ```bash pnpm add @solar-icons/angular ``` ```bash npm install @solar-icons/angular ``` ```bash yarn add @solar-icons/angular ``` ## Usage [#usage] ### Components [#components] Import individual icon components: ```tsx import { Component } from '@angular/core' import { HeartBold } from '@solar-icons/angular' @Component({ standalone: true, imports: [HeartBold], template: ``, }) export class App {} ``` ## Dynamic Rendering [#dynamic-rendering] For runtime lookup or dynamic name swapping, use the `SolarIcon` directive. ### 1. Register icons [#1-register-icons] Register icons to expose them to dynamic lookup: ```tsx import { provideSolarIcons } from '@solar-icons/angular' import { HeartBold, StarBold } from '@solar-icons/angular/like' bootstrapApplication(App, { providers: [provideSolarIcons({ HeartBold, StarBold })], }) ``` ### 2. Render dynamic icons [#2-render-dynamic-icons] Import `SolarIcon` and pass the name or component class to `solarIcon`: ```tsx import { SolarIcon, SunBold } from '@solar-icons/angular' @Component({ standalone: true, imports: [SolarIcon], template: ` `, }) export class App { protected readonly Sun = SunBold } ``` Angular might warn that the component is unused (`NG8113`) when referencing classes directly. You can safely ignore this. ## Inputs & Props [#inputs--props] Icon components support these inputs: | Input | Type | Default | Description | | ---------- | ------------------ | ---------------- | ------------------------------------------- | | `size` | `string \| number` | `'1em'` | Pixels or CSS units (e.g., `32`, `'2rem'`). | | `color` | `string` | `'currentColor'` | CSS color value. | | `alt` | `string` | `undefined` | Adds `` and accessibility label. | | `mirrored` | `boolean` | `false` | Flips the icon horizontally. | When `alt` is set, the component renders a `<title>` tag for screen readers. Otherwise, it defaults to `aria-hidden="true"`. ## Attribute Selectors [#attribute-selectors] This package targets SVGs using attribute selectors (e.g., `solarHeartBold` on `<svg>`) rather than custom wrapper tags. ```html <!-- Native SVG element --> <svg solarHeartBold [size]="24" /> ``` This keeps the DOM tree clean, permits direct CSS targeting, and avoids wrapper element overhead. # Nuxt (/docs/v1/packages/nuxt) Use `@solar-icons/nuxt` to integrate Solar icons into Nuxt 3+ applications. It wraps `@solar-icons/vue` to enable auto-import, global configuration, and SSR optimization. ```shell nuxi module add @solar-icons/nuxt ``` ## Features [#features] - **Auto-import**: Icons are registered as global Vue components with an optional prefix. - **Global styling**: Set default props directly in `nuxt.config.ts`. - **SSR optimization**: Pre-configured for Nuxt 3 server-side rendering. ## Configuration [#configuration] Configure options in `nuxt.config.ts`: ```js // nuxt.config.ts export default defineNuxtConfig({ modules: ['@solar-icons/nuxt'], solarIcons: { namePrefix: 'Solar', // Component prefix (default: 'Solar') autoImport: true, // Auto-import all icons (default: true) provider: true, // Enable global provider context (default: true) color: 'currentColor', size: 24, weight: 'Linear', mirrored: false, }, }) ``` ## Usage [#usage] ### Auto-imported Components [#auto-imported-components] With auto-import enabled, render icons directly using their prefixed names (default: `Solar` + Category + IconName): ```vue <template> <div> <SolarArrowUp :size="24" weight="Outline" :mirrored="true" /> <SolarArrowsArrowDown :size="32" weight="BoldDuotone" /> <SolarArrowsAltArrowLeft color="#fff" class="bg-black" weight="Bold" /> </div> </template> ``` ### Manual Imports [#manual-imports] You can also import manually using path aliases: ```vue <template> <div> <ArrowUp :size="24" weight="Outline" /> <solar.Arrows.ArrowDown :size="32" weight="BoldDuotone" /> </div> </template> <script setup> import { ArrowUp } from '#solar-icons' import * as solar from '#solar-icons/category' </script> ``` Available aliases: - `#solar-icons` - Exports Vue components. - `#solar-icons/lib` - Exports utilities (e.g., `SolarProvider`, `useSolar`). - `#solar-icons/category` - Exports categorized icon sets. ### Composition API [#composition-api] Read or update default settings dynamically: ```vue <template> <div> <ArrowUp :size="iconSize" weight="Outline" /> <button @click="increaseSize">Resize</button> </div> </template> <script setup> import { ref } from 'vue' import { ArrowUp, useSolar } from '#solar-icons/lib' const { config, setSize } = useSolar() const iconSize = ref(24) const increaseSize = () => { const newSize = parseInt(iconSize.value) + 4 iconSize.value = newSize setSize(newSize) } </script> ``` ## Props [#props] Icon components accept standard SVG attributes alongside these props: | Prop | Type | Default | Description | | ---------- | ------------------------------------------------------------------------------- | -------------- | -------------------------------------- | | `color` | `string` | `currentColor` | Sets the icon color. | | `size` | `string \| number` | `24` | Sets width and height. | | `weight` | `'Bold' \| 'Linear' \| 'Outline' \| 'BoldDuotone' \| 'LineDuotone' \| 'Broken'` | `Linear` | Sets icon style. | | `mirrored` | `boolean` | `false` | Flips the icon horizontally if `true`. | | `alt` | `string` | `undefined` | Accessibility title. | # React Native (/docs/v1/packages/react-native) Use `@solar-icons/react-native` to integrate Solar icons into React Native and Expo applications. Requires `react-native-svg`. ```package-install @solar-icons/react-native react-native-svg ``` ## Features [#features] - **7,476 icons**: Every style variant compiled for React Native. - **Expo compatible**: Works out of the box in Expo environments. - **TypeScript ready**: Full type definitions included. --- ## Import Methods [#import-methods] This package offers three import strategies. All methods are tree-shakeable. ### 1. Import by Style [#1-import-by-style] Import multiple icons of the same style: ```tsx import { House, User, Settings } from '@solar-icons/react-native/Bold' ``` ### 2. Import globally by Name [#2-import-globally-by-name] Import icons with style suffixes from the root: ```tsx import { HouseBold, HouseLinear, HeartBroken } from '@solar-icons/react-native' ``` ### 3. Import by Category [#3-import-by-category] Import from the specific category and style path: ```tsx import { House } from '@solar-icons/react-native/category/buildings/Bold' ``` --- ## Props [#props] All components accept standard props extending `SvgProps` from `react-native-svg` (except `width` and `height`): | Prop | Type | Default | Description | | :--------- | :----------------- | :--------------- | :--------------------------- | | `size` | `number \| string` | `24` | Icon width and height. | | `color` | `string` | `'currentColor'` | Icon fill or stroke color. | | `mirrored` | `boolean` | `false` | Flips the icon horizontally. | --- ## Technical Details [#technical-details] ### Package Entry Points [#package-entry-points] | Entry Point | Content | | :------------- | :----------------------------------------------- | | `.` | Global exports and types. | | `./[Style]` | Style-specific bundles (e.g., `Bold`, `Linear`). | | `./category/*` | Direct imports for individual icons. | | `./lib/*` | Core logic, `IconBase`, and TypeScript types. | # React Performance (/docs/v1/packages/react-perf) Use `@solar-icons/react-perf` for production builds where bundle size is critical. Each component bundles only one icon style. ```package-install @solar-icons/react-perf ``` ## Features [#features] - **Performance-focused**: Each style variant is a separate component (e.g., `HomeBold`). - **Minimal bundle size**: Tree-shaking removes all unused styles from the build. - **TypeScript ready**: Full type definitions included. ## Usage [#usage] Import components using their combined name and weight: ```jsx import { HomeBold, SettingsLinear } from '@solar-icons/react-perf' function App() { return ( <div> <HomeBold color="green" size={24} /> <SettingsLinear color="orange" size={24} /> </div> ) } ``` ### Import by Style Path [#import-by-style-path] For cleaner component names, import from the style-specific entry point: ```jsx import { Home } from '@solar-icons/react-perf/bold' import { Settings } from '@solar-icons/react-perf/linear' function App() { return ( <div> <Home size={24} /> <Settings size={24} /> </div> ) } ``` ## Props [#props] Icon components accept standard HTML SVG attributes alongside these props: | Prop | Type | Default | Description | | ---------- | ------------------ | -------------- | -------------------------------------- | | `color` | `string` | `currentColor` | Sets the icon color. | | `size` | `string \| number` | `1em` | Sets width and height. | | `mirrored` | `boolean` | `false` | Flips the icon horizontally if `true`. | | `alt` | `string` | `undefined` | Accessibility title. | # React (/docs/v1/packages/react) Use `@solar-icons/react` for standard React applications. It supports dynamic styles, global configuration context, and client/server rendering. ```package-install @solar-icons/react ``` ## Features [#features] - **Dynamic weights**: Change styles at runtime using the `weight` prop. - **Global styling**: Set default styles using `SolarProvider`. - **Tree-shakeable**: Bundles only the icons you import. - **RSC & SSR ready**: Works with Server-Side Rendering (SSR) and Server Components. ## Usage [#usage] ```jsx import { Home } from '@solar-icons/react' function App() { return <Home weight="Bold" color="purple" size={32} /> } ``` ## Props [#props] Icon components accept all standard HTML SVG attributes alongside these props: | Prop | Type | Default | Description | | ---------- | ------------------------------------------------------------------------------- | -------------- | ---------------------------------------------- | | `color` | `string` | `currentColor` | Sets the icon color. Inherits from provider. | | `size` | `string \| number` | `1em` | Sets width and height. Inherits from provider. | | `weight` | `'Bold' \| 'Linear' \| 'Outline' \| 'BoldDuotone' \| 'LineDuotone' \| 'Broken'` | `Linear` | Sets icon style. Inherits from provider. | | `mirrored` | `boolean` | `false` | Flips the icon horizontally if `true`. | | `alt` | `string` | `undefined` | Accessibility title. | --- ## Category Imports [#category-imports] Import all icons in a category as a single object: ```jsx import { Arrows } from '@solar-icons/react/category' function App() { return ( <div> <Arrows.ArrowUp weight="Bold" /> <Arrows.ArrowDown weight="Linear" /> </div> ) } ``` # Solid (/docs/v1/packages/solid) Use `@solar-icons/solid` in SolidJS applications. It features reactive components optimized for minimal bundle size. ```package-install @solar-icons/solid ``` ## Features [#features] - **SolidJS ready**: Reactivity optimized. - **Tree-shakeable**: Bundles only the icons you import. - **TypeScript ready**: Full type definitions included. ## Usage [#usage] Import icons from a style and use them as Solid components: ```tsx import { House } from '@solar-icons/solid/Bold' function App() { return <House size={32} color="purple" /> } ``` ## Props [#props] Icon components accept standard SVG attributes alongside these props: | Prop | Type | Default | Description | | ---------- | ------------------ | -------------- | -------------------------------------- | | `color` | `string` | `currentColor` | Sets the icon color. | | `size` | `string \| number` | `1em` | Sets width and height. | | `mirrored` | `boolean` | `false` | Flips the icon horizontally if `true`. | | `alt` | `string` | `undefined` | Accessibility title. | --- ## Import Patterns [#import-patterns] ### Import by Style [#import-by-style] Import all icons in a style: ```tsx import { House, Settings, User } from '@solar-icons/solid/Bold' import { House as HouseLinear } from '@solar-icons/solid/Linear' function App() { return ( <> <House size={24} /> <HouseLinear size={24} /> </> ) } ``` Available styles: `Bold`, `Linear`, `Outline`, `BoldDuotone`, `LineDuotone`, `Broken`. ### Import by Category [#import-by-category] Import icons in a category: ```tsx import { Bold, Linear } from '@solar-icons/solid/category/arrows' function App() { return ( <> <Bold.ArrowUp size={24} /> <Linear.ArrowDown size={24} /> </> ) } ``` ### Direct Component Import [#direct-component-import] Import individual components directly: ```tsx import { House } from '@solar-icons/solid/category/building/Bold' function App() { return <House size={24} color="#f59e0b" /> } ``` --- ## IconBase Component [#iconbase-component] Use `IconBase` to build custom icons: ```tsx import { IconBase } from '@solar-icons/solid' function App() { return ( <IconBase size={24} color="red"> <path d="M12 2L15.09 8.26..." fill="currentColor" /> </IconBase> ) } ``` # Svelte (/docs/v1/packages/svelte) Use `@solar-icons/svelte` in Svelte 5 projects. Built with runes for optimal performance and minimal bundle size. ```package-install @solar-icons/svelte ``` ## Features [#features] - **Svelte 5 ready**: Built with runes. - **Tree-shakeable**: Bundles only the icons you import. - **TypeScript ready**: Full type definitions included. ## Usage [#usage] Import icons from a style and use them as Svelte components: ```svelte <script> import { House } from '@solar-icons/svelte/Bold' </script> <House size={32} color="purple" /> ``` ## Props [#props] Icon components accept standard SVG attributes alongside these props: | Prop | Type | Default | Description | | ---------- | ------------------ | -------------- | -------------------------------------- | | `color` | `string` | `currentColor` | Sets the icon color. | | `size` | `string \| number` | `1em` | Sets width and height. | | `mirrored` | `boolean` | `false` | Flips the icon horizontally if `true`. | | `alt` | `string` | `undefined` | Accessibility title. | --- ## Import Patterns [#import-patterns] ### Import by Style [#import-by-style] Import all icons in a style: ```svelte <script> import { House, Settings, User } from '@solar-icons/svelte/Bold' import { House as HouseLinear } from '@solar-icons/svelte/Linear' </script> <House size={24} /> <HouseLinear size={24} /> ``` Available styles: `Bold`, `Linear`, `Outline`, `BoldDuotone`, `LineDuotone`, `Broken`. ### Import by Category [#import-by-category] Import icons in a category: ```svelte <script> import { Bold, Linear } from '@solar-icons/svelte/category/arrows' </script> <Bold.ArrowUp size={24} /> <Linear.ArrowDown size={24} /> ``` ### Direct Component Import [#direct-component-import] Import individual components directly: ```svelte <script> import House from '@solar-icons/svelte/category/buildings/Bold/House.svelte' </script> <House size={24} color="#f59e0b" /> ``` --- ## IconBase Component [#iconbase-component] Use `IconBase` to build custom icons: ```svelte <script> import { IconBase } from '@solar-icons/svelte' </script> <IconBase size={24} color="red"> <path d="M12 2L15.09 8.26..." fill="currentColor" /> </IconBase> ``` # Vue (/docs/v1/packages/vue) Use `@solar-icons/vue` in Vue 3 applications. It supports dynamic styles, global configuration, and works with Vue 3 and Nuxt. ```package-install @solar-icons/vue ``` ## Features [#features] - **Dynamic weights**: Change styles at runtime using the `weight` prop. - **Global styling**: Set default styles using `SolarProvider` or a plugin. - **Tree-shakeable**: Bundles only the icons you import. - **TypeScript ready**: Full type definitions included. ## Usage [#usage] ```vue <template> <div> <Home weight="Bold" color="purple" :size="32" /> </div> </template> <script setup> import { Home } from '@solar-icons/vue' </script> ``` ## Props [#props] Icon components accept standard SVG attributes alongside these props: | Prop | Type | Default | Description | | ---------- | ------------------------------------------------------------------------------- | -------------- | ---------------------------------------------- | | `color` | `string` | `currentColor` | Sets the icon color. Inherits from provider. | | `size` | `string \| number` | `24` | Sets width and height. Inherits from provider. | | `weight` | `'Bold' \| 'Linear' \| 'Outline' \| 'BoldDuotone' \| 'LineDuotone' \| 'Broken'` | `Linear` | Sets icon style. Inherits from provider. | | `mirrored` | `boolean` | `false` | Flips the icon horizontally if `true`. | | `alt` | `string` | `undefined` | Accessibility title. | --- ## Advanced Usage [#advanced-usage] ### Global Configuration with `SolarProvider` [#global-configuration-with-solarprovider] Wrap components in `SolarProvider` to apply default settings: ```vue <template> <SolarProvider :size="32" color="purple" weight="Linear"> <YourComponents /> </SolarProvider> </template> <script setup> import { SolarProvider } from '@solar-icons/vue' </script> ``` ### Vue Plugin [#vue-plugin] Alternatively, configure defaults globally via the Vue plugin: ```js import { createApp } from 'vue' import { SolarIconsPlugin } from '@solar-icons/vue' const app = createApp(App) app.use(SolarIconsPlugin, { color: 'currentColor', size: '24', weight: 'Linear', mirrored: false, }) app.mount('#app') ``` ### Composition API [#composition-api] Access and modify settings dynamically using `useSolar`: ```vue <template> <div> <ArrowUp :size="iconSize" weight="Outline" /> <button @click="increaseSize">Increase Size</button> </div> </template> <script setup> import { ref } from 'vue' import { ArrowUp, useSolar } from '@solar-icons/vue' const { config, setSize } = useSolar() const iconSize = ref(24) const increaseSize = () => { const newSize = parseInt(iconSize.value) + 4 iconSize.value = newSize setSize(newSize) } </script> ``` ### Category Imports [#category-imports] Import categorized collections as a single object: ```vue <template> <div> <Arrows.ArrowUp weight="Bold" /> <Arrows.ArrowDown weight="Linear" /> </div> </template> <script setup> import { Arrows } from '@solar-icons/vue/category' </script> ``` ## Nuxt Integration [#nuxt-integration] For Nuxt 3 projects, use the dedicated `@solar-icons/nuxt` package for auto-import support. ```shell nuxi module add @solar-icons/nuxt ``` # Accessibility (/docs/v2/advanced/accessibility) Solar Icons renders `<svg>` elements with sensible defaults and provides props for full control. ## Default behavior [#default-behavior] Every icon is **decorative by default**. If you do not pass an accessibility label, the SVG renders with `aria-hidden="true"`. Screen readers skip it. ```jsx <HeartIcon color="#ef4444" size={24} /> // Renders: <svg aria-hidden="true" ...> ``` This matches the [WAI-ARIA recommendation](https://www.w3.org/WAI/tutorials/images/decorative/) for decorative images. ## Providing a label [#providing-a-label] Pass `alt` to turn the icon into a meaningful element. The SVG gets a `<title>` child and removes `aria-hidden`. ```jsx <HeartIcon alt="Add to favorites" color="#ef4444" /> // Renders: <svg><title>Add to favorites... ``` Screen readers announce "Add to favorites, image". ### Additional attributes [#additional-attributes] Use `aria-label` or `title` for finer control. Both prevent `aria-hidden`: ```jsx ``` ## Color contrast [#color-contrast] Icons inherit their color from the CSS cascade. They default to `currentColor`, which means the icon matches the surrounding text color. Use standard CSS color contrast techniques for text, and the icons follow. ```jsx

Add to favorites

``` When setting explicit colors with the `color` prop, verify the contrast ratio against the background: ```jsx // Good: blue-500 on white = 4.5:1 contrast ratio // Bad: yellow-200 on white = insufficient contrast ``` ## Focus and interaction [#focus-and-interaction] Icons are not focusable by default. They pass through any event handlers you attach: ```jsx addFavorite()} className="cursor-pointer" alt="Favorite" /> ``` For icons that act as interactive elements, wrap them in a semantic button: ```jsx ``` ## SVG attributes [#svg-attributes] Every icon accepts standard SVG attributes (`className`, `style`, `onClick`, `onFocus`, etc.). These pass through to the `` element. Use them for any additional ARIA or styling needs. # Global Configuration (/docs/v2/advanced/global-configuration) `SolarProvider` sets CSS custom properties that cascade to every icon inside it. Icons inherit defaults without re-rendering. ## Provider cascade [#provider-cascade] Place `SolarProvider` near the root. Nest providers to override for subtrees. ```jsx import { SolarProvider } from '@solar-icons/react' import { HeartIcon } from '@solar-icons/react/bold' import { SettingsIcon } from '@solar-icons/react/bold' function App() { return (
) } ``` ## CSS variables [#css-variables] | Provider prop | CSS Variable | Role | | ------------------ | --------------------------- | ------------------------------------------ | | `color` | `--solar-color` | Fill and stroke color | | `size` | `--solar-size` | Width and height | | `strokeWidth` | `--solar-stroke-width` | Stroke width for Linear/Broken/LineDuotone | | `secondaryColor` | `--solar-secondary-color` | Duotone accent color | | `secondaryOpacity` | `--solar-secondary-opacity` | Duotone accent opacity | Overriding a variable on an individual icon takes precedence over the provider. ## Dynamic color themes [#dynamic-color-themes] Build a theme switcher with `useSolar`. ```jsx import { useSolar, SolarProvider } from '@solar-icons/react' import { HeartIcon } from '@solar-icons/react/bold-duotone' function ThemeSwitcher() { const { setColor, setSecondaryColor } = useSolar() return (
) } function App() { return ( ) } ``` ## Framework patterns [#framework-patterns] ### Vue [#vue] ```vue ``` ### Svelte [#svelte] Provider props are `$bindable()`: ```svelte ``` ### Angular [#angular] ```html ``` ### React Native [#react-native] Uses React Context instead of CSS variables. ```jsx import { SolarProvider } from '@solar-icons/react-native' function App() { return ( ) } ``` ## Isolated icons [#isolated-icons] Set `isolated` to disconnect the icon from `SolarProvider`. The icon then reads `currentColor` from its CSS parent and uses hardcoded defaults for size and stroke. ```jsx import { HeartIcon } from '@solar-icons/react/bold' function App() { return ( ) } ``` See the [Global Styling page](/docs/v2/advanced/global-styling#isolated-mode) for the full list of values `isolated` sets. # Global Styling (/docs/v2/advanced/global-styling) Solar Icons v2 uses CSS custom properties instead of React Context or runtime props to pass default values. The wrapper element does not update on prop change. The browser's native CSS cascade handles propagation. ## CSS variable cascade [#css-variable-cascade] `SolarProvider` sets CSS custom properties on a `
` with `display: contents`. Every icon inside reads these variables through normal CSS inheritance. ```jsx import { SolarProvider } from '@solar-icons/react' import { HeartIcon } from '@solar-icons/react/bold' ; ``` The provider sets `--solar-color: #3b82f6` on the wrapper. The icon reads `var(--solar-color, currentColor)` for its fill and stroke. ## Priority rules [#priority-rules] When multiple sources set the same property, the winner follows the rules below. 1. **Explicit prop on the icon** (highest priority). Sets inline style on the SVG. 2. **SolarProvider** (CSS variables). The icon reads `var(--solar-color, currentColor)`. When the provider sets the var, it is defined and the icon uses it. 3. **Direct CSS parent** (only when the icon is `isolated` or no provider exists). The `isolated` prop forces `currentColor` on the icon, which resolves to the closest CSS ancestor's `color` property. 4. **System default** (`24px`, `currentColor`, `1.5`). ### Example [#example] ```jsx ``` - `ArrowUpIcon` reads `var(--solar-color, currentColor)`. The provider sets `--solar-color: red`. The var is defined, so the icon uses **red**. - `ArrowDownIcon isolated` skips the provider's CSS var entirely. The SVG's `color` attribute is set to `currentColor`, which resolves to the button's `color: blue`. The icon uses **blue**. - `ArrowLeftIcon color="yellow"` sets inline `color: yellow` on the SVG. Inline style beats everything. The icon uses **yellow**. ## Isolated mode [#isolated-mode] Set `isolated` on an icon to disconnect it from `SolarProvider`. The icon then reads its values from its CSS parent (via `currentColor` for color) and uses hardcoded defaults for size and stroke. ```jsx ``` When `isolated` is `true`: - Color: `currentColor`. Resolves to the closest CSS ancestor's `color` property - Size: `24px` (hardcoded) - Stroke width: `1.5` (hardcoded) - Duotone CSS variables: `initial` (re-initialized to browser default) Use `isolated` when: - An icon sits inside a styled parent (button, link, card) and should match that parent's color - An icon is rendered in a portal or shadow DOM where CSS variable inheritance breaks - You want a subtree of icons to diverge from the global theme ## Provider nesting [#provider-nesting] Nest `SolarProvider` components to override values for a subtree. ```jsx
{/* Icons here: blue, 24px */} {/* Icons here: red, 16px */}