### Install Phosphor Icons Svelte Source: https://github.com/babakfp/phosphor-icons-svelte/blob/main/README.md Use this command to add the latest version of the library to your project. ```bash pnpm add -D phosphor-icons-svelte ``` -------------------------------- ### Install Phosphor Icons Svelte Source: https://context7.com/babakfp/phosphor-icons-svelte/llms.txt Install the package as a dev dependency. Requires Svelte 5 or later. ```bash # Svelte 5+ (current) pnpm add -D phosphor-icons-svelte # Svelte 4 or earlier (legacy) pnpm add -D phosphor-icons-svelte@1.1.2 ``` -------------------------------- ### Install Older Version of Phosphor Icons Svelte Source: https://github.com/babakfp/phosphor-icons-svelte/blob/main/README.md If you are using an older version of Svelte (4 or earlier), install version 1.1.2 instead. ```bash pnpm add -D phosphor-icons-svelte@1.1.2 ``` -------------------------------- ### RTL Text Direction Icon Mirroring Source: https://github.com/babakfp/phosphor-icons-svelte/blob/main/README.md CSS example demonstrating how icons with `data-phosphor-icon` attribute are mirrored for right-to-left text direction. ```css [dir="rtl"] [data-phosphor-icon="heart"] { transform: scaleX(-1); } ``` -------------------------------- ### Svelte Icon Component Naming Convention Source: https://context7.com/babakfp/phosphor-icons-svelte/llms.txt Phosphor Icons Svelte components follow the pattern 'Icon' + PascalCase(icon-name) + PascalCase(weight). This example shows correct individual imports for different weights of the same icon. ```svelte ``` -------------------------------- ### Alternative Icon Import Syntax (Not Recommended) Source: https://github.com/babakfp/phosphor-icons-svelte/blob/main/README.md This syntax is shown for comparison but is not recommended due to potential performance issues, as it can lead to importing all icons at once. ```svelte ``` -------------------------------- ### Import and Render Phosphor Icons Source: https://context7.com/babakfp/phosphor-icons-svelte/llms.txt Import individual icon components from their specific file paths. Component names follow the pattern `Icon{Name}{Weight}`. ```svelte ``` -------------------------------- ### Basic Icon Usage in Svelte Source: https://github.com/babakfp/phosphor-icons-svelte/blob/main/README.md Import and use specific icon components in your Svelte application. Ensure you import each icon individually to optimize build performance. ```svelte ``` -------------------------------- ### Styling Icons with the Class Prop Source: https://github.com/babakfp/phosphor-icons-svelte/blob/main/README.md Apply custom styles to icon components by passing a class name to the `class` prop. This is the only prop available for styling. ```svelte ``` -------------------------------- ### Usage in an RTL-Aware Svelte Layout Source: https://context7.com/babakfp/phosphor-icons-svelte/llms.txt Import and use directional icons within an element that has the 'dir="rtl"' attribute. The CSS defined previously will automatically flip the icon. ```svelte
``` -------------------------------- ### Mirror Icons in RTL Layouts with CSS Source: https://context7.com/babakfp/phosphor-icons-svelte/llms.txt Use CSS attribute selectors to mirror directional icons when the 'dir' attribute is set to 'rtl'. This applies to icons with names implying direction. ```css [dir="rtl"] [data-phosphor-icon="arrow-right"] { transform: scaleX(-1); } /* Mirror any icon that implies direction */ [dir="rtl"] [data-phosphor-icon="caret-right"] { transform: scaleX(-1); } [dir="rtl"] [data-phosphor-icon="heart"] { transform: scaleX(-1); } ``` -------------------------------- ### Style Icons with the `class` Prop Source: https://context7.com/babakfp/phosphor-icons-svelte/llms.txt Use the `class` prop to apply Tailwind utility classes, CSS Modules, or custom class names for styling. The icon inherits size from surrounding font-size. ```svelte ``` -------------------------------- ### Default SVG Attributes for Icons Source: https://context7.com/babakfp/phosphor-icons-svelte/llms.txt Icons automatically include attributes like `width`, `height`, `fill`, `pointer-events`, `display`, `aria-hidden`, and `data-phosphor-icon` for accessibility and styling. ```svelte

Sunny day

``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.