Packages
React
Solar Icons for React. Supports dynamic styles and global configuration.
Use @solar-icons/react for standard React applications. It supports dynamic styles, global configuration context, and client/server rendering.
npm install @solar-icons/reactFeatures
- Dynamic weights: Change styles at runtime using the
weightprop. - 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
import { Home } from '@solar-icons/react'
function App() {
return <Home weight="Bold" color="purple" size={32} />
}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
Import all icons in a category as a single object:
import { Arrows } from '@solar-icons/react/category'
function App() {
return (
<div>
<Arrows.ArrowUp weight="Bold" />
<Arrows.ArrowDown weight="Linear" />
</div>
)
}How is this guide?
Last updated on