@fluentui/react-icons 2.0.323 → 2.0.324-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (72) hide show
  1. package/README.md +9 -90
  2. package/docs/build-transforms.md +142 -0
  3. package/docs/preview-features/README.md +13 -0
  4. package/docs/preview-features/base.md +184 -0
  5. package/docs/preview-features/svg-sprites.md +158 -0
  6. package/lib/atoms/svg/comment-arrow-left.js +4 -4
  7. package/lib/atoms/svg/comment-arrow-right.js +14 -14
  8. package/lib/atoms/svg/text-grammar-arrow-right.js +6 -6
  9. package/lib/atoms/svg/text-paragraph.js +8 -8
  10. package/lib/base/bundleIcon.d.ts +8 -0
  11. package/lib/base/bundleIcon.js +18 -0
  12. package/lib/base/createFluentIcon.d.ts +20 -0
  13. package/lib/base/createFluentIcon.js +38 -0
  14. package/lib/base/createFluentIcon.svg-sprite.d.ts +9 -0
  15. package/lib/base/createFluentIcon.svg-sprite.js +28 -0
  16. package/lib/base/fonts/createFluentFontIcon.d.ts +20 -0
  17. package/lib/base/fonts/createFluentFontIcon.js +45 -0
  18. package/lib/base/fonts/index.d.ts +2 -0
  19. package/lib/base/fonts/index.js +2 -0
  20. package/lib/base/index.d.ts +8 -0
  21. package/lib/base/index.js +12 -0
  22. package/lib/base/shared.d.ts +15 -0
  23. package/lib/base/shared.js +19 -0
  24. package/lib/base/useIconState.d.ts +15 -0
  25. package/lib/base/useIconState.js +38 -0
  26. package/lib/icons/chunk-0.js +2 -2
  27. package/lib/icons/chunk-22.js +4 -4
  28. package/lib/sizedIcons/chunk-0.js +16 -16
  29. package/lib/sizedIcons/chunk-22.js +10 -10
  30. package/lib/utils/fonts/FluentSystemIcons-Filled.ttf +0 -0
  31. package/lib/utils/fonts/FluentSystemIcons-Filled.woff +0 -0
  32. package/lib/utils/fonts/FluentSystemIcons-Filled.woff2 +0 -0
  33. package/lib/utils/fonts/FluentSystemIcons-Regular.ttf +0 -0
  34. package/lib/utils/fonts/FluentSystemIcons-Regular.woff +0 -0
  35. package/lib/utils/fonts/FluentSystemIcons-Regular.woff2 +0 -0
  36. package/lib/utils/fonts/FluentSystemIcons-Resizable.ttf +0 -0
  37. package/lib/utils/fonts/FluentSystemIcons-Resizable.woff +0 -0
  38. package/lib/utils/fonts/FluentSystemIcons-Resizable.woff2 +0 -0
  39. package/lib-cjs/atoms/svg/comment-arrow-left.js +4 -4
  40. package/lib-cjs/atoms/svg/comment-arrow-right.js +14 -14
  41. package/lib-cjs/atoms/svg/text-grammar-arrow-right.js +6 -6
  42. package/lib-cjs/atoms/svg/text-paragraph.js +8 -8
  43. package/lib-cjs/base/bundleIcon.d.ts +8 -0
  44. package/lib-cjs/base/bundleIcon.js +23 -0
  45. package/lib-cjs/base/createFluentIcon.d.ts +20 -0
  46. package/lib-cjs/base/createFluentIcon.js +43 -0
  47. package/lib-cjs/base/createFluentIcon.svg-sprite.d.ts +9 -0
  48. package/lib-cjs/base/createFluentIcon.svg-sprite.js +33 -0
  49. package/lib-cjs/base/fonts/createFluentFontIcon.d.ts +20 -0
  50. package/lib-cjs/base/fonts/createFluentFontIcon.js +50 -0
  51. package/lib-cjs/base/fonts/index.d.ts +2 -0
  52. package/lib-cjs/base/fonts/index.js +6 -0
  53. package/lib-cjs/base/index.d.ts +8 -0
  54. package/lib-cjs/base/index.js +31 -0
  55. package/lib-cjs/base/shared.d.ts +15 -0
  56. package/lib-cjs/base/shared.js +29 -0
  57. package/lib-cjs/base/useIconState.d.ts +15 -0
  58. package/lib-cjs/base/useIconState.js +42 -0
  59. package/lib-cjs/icons/chunk-0.js +2 -2
  60. package/lib-cjs/icons/chunk-22.js +4 -4
  61. package/lib-cjs/sizedIcons/chunk-0.js +16 -16
  62. package/lib-cjs/sizedIcons/chunk-22.js +10 -10
  63. package/lib-cjs/utils/fonts/FluentSystemIcons-Filled.ttf +0 -0
  64. package/lib-cjs/utils/fonts/FluentSystemIcons-Filled.woff +0 -0
  65. package/lib-cjs/utils/fonts/FluentSystemIcons-Filled.woff2 +0 -0
  66. package/lib-cjs/utils/fonts/FluentSystemIcons-Regular.ttf +0 -0
  67. package/lib-cjs/utils/fonts/FluentSystemIcons-Regular.woff +0 -0
  68. package/lib-cjs/utils/fonts/FluentSystemIcons-Regular.woff2 +0 -0
  69. package/lib-cjs/utils/fonts/FluentSystemIcons-Resizable.ttf +0 -0
  70. package/lib-cjs/utils/fonts/FluentSystemIcons-Resizable.woff +0 -0
  71. package/lib-cjs/utils/fonts/FluentSystemIcons-Resizable.woff2 +0 -0
  72. package/package.json +8 -6
package/README.md CHANGED
@@ -336,106 +336,25 @@ Without this setting, TypeScript will not be able to resolve the individual icon
336
336
 
337
337
  Migrating a larger codebase to the new performant atomic imports might be a daunting task. To make this migration more straightforward, you can leverage build-time import transforms to get all the benefits without modifying your actual code.
338
338
 
339
- These transforms automatically rewrite imports from:
339
+ Use `svg` as the target path. This transformation happens at build time, so your source code remains unchanged while your bundled output gets the full tree-shaking benefits.
340
340
 
341
- ```tsx
342
- import { AccessTime24Filled } from '@fluentui/react-icons';
343
- ```
344
-
345
- To the optimized atomic import:
346
-
347
- ```tsx
348
- import { AccessTime24Filled } from '@fluentui/react-icons/svg/access-time';
349
- ```
341
+ 👉 **[Build-Time Transform setup (Babel & SWC) →](./docs/build-transforms.md)**
350
342
 
351
- This transformation happens at build time, so your source code remains unchanged while your bundled output gets the full tree-shaking benefits.
352
-
353
- #### Babel
354
-
355
- If you use Babel for transpilation, add [babel-plugin-transform-imports](https://www.npmjs.com/package/babel-plugin-transform-imports) with the following setup:
356
-
357
- ```js
358
- // @filename .babelrc.js
359
- module.exports = {
360
- presets: [
361
- // ... your preset configuration
362
- ],
363
- plugins: [
364
- [
365
- 'transform-imports',
366
- {
367
- '@fluentui/react-icons': {
368
- transform: (importName) => {
369
- if (importName === 'useIconContext' || importName === 'IconDirectionContextProvider') {
370
- return '@fluentui/react-icons/providers';
371
- }
372
-
373
- // Icons end with a style suffix
374
- const isIcon = importName.match(/(\d*)?(Regular|Filled|Light|Color)$/);
375
- if (!isIcon) {
376
- return '@fluentui/react-icons/utils';
377
- }
378
-
379
- const withoutSuffix = importName.replace(/(\d*)?(Regular|Filled|Light|Color)$/, '');
380
-
381
- const kebabCase = withoutSuffix.replace(/([a-z0-9])([A-Z])/g, '$1-$2').toLowerCase();
382
-
383
- return `@fluentui/react-icons/svg/${kebabCase}`;
384
- },
385
- preventFullImport: false,
386
- skipDefaultConversion: true,
387
- },
388
- },
389
- ],
390
- ],
391
- };
392
- ```
343
+ ## Atomic API (SVG Sprites) ⚠️ Alpha
393
344
 
394
- #### SWC
345
+ > **This feature is available as an alpha prerelease only.** Install via `npm i @fluentui/react-icons@alpha`
395
346
 
396
- If you use SWC for transpilation, add [@swc/plugin-transform-imports](https://www.npmjs.com/package/@swc/plugin-transform-imports) with the following setup:
347
+ SVG sprites offer smaller bundles, faster renders, and zero runtime overhead.
397
348
 
398
- ```jsonc
399
- // @filename .swcrc
400
- {
401
- "jsc": {
402
- "experimental": {
403
- "plugins": [
404
- [
405
- "@swc/plugin-transform-imports",
406
- {
407
- "@fluentui/react-icons": {
408
- "transform": [
409
- // Transform provider imports to /providers
410
- ["^(useIconContext|IconDirectionContextProvider)$", "@fluentui/react-icons/providers"],
411
- // Transform icon imports to /svg/{icon-name}
412
- [
413
- "(\\D*)(\\d*)?(Regular|Filled|Light|Color)$",
414
- "@fluentui/react-icons/svg/{{ kebabCase memberMatches.[1] }}",
415
- ],
416
- // Fallback: all other exports are utilities
417
- [".*", "@fluentui/react-icons/utils"],
418
- ],
419
- "preventFullImport": false,
420
- "skipDefaultConversion": true,
421
- "handleDefaultImport": false,
422
- "handleNamespaceImport": false,
423
- },
424
- },
425
- ],
426
- ],
427
- },
428
- },
429
- }
430
- ```
349
+ 👉 **[Full documentation →](./docs/preview-features/svg-sprites.md)**
431
350
 
432
- ## Atomic API (SVG Sprites) — ⚠️ Alpha
351
+ ## Base API — ⚠️ Alpha
433
352
 
434
353
  > **This feature is available as an alpha prerelease only.** Install via `npm i @fluentui/react-icons@alpha`
435
354
 
436
- SVG sprites offer smaller bundles, faster renders, and zero runtime overhead.
355
+ A drop-in replacement for the standard API that removes the CSS-in-JS runtime — provides data-attribute selectors for styling behaviour with opt-in pre-defined vanilla CSS.
437
356
 
438
- 👉 **[Full documentation →](./docs/preview-features.md#atomic-api-svg-sprites)**
357
+ 👉 **[Full documentation →](./docs/preview-features/base.md)**
439
358
 
440
359
  ## Viewing Icons
441
360
 
@@ -0,0 +1,142 @@
1
+ # Build-Time Import Transforms
2
+
3
+ You can keep root-level barrel imports and leverage build-time transforms to automatically rewrite them to optimized atomic imports — no source code changes required.
4
+
5
+ These transforms rewrite imports from:
6
+
7
+ ```tsx
8
+ import { AccessTime24Filled } from '@fluentui/react-icons';
9
+ ```
10
+
11
+ To the optimized atomic import for your chosen target:
12
+
13
+ ```tsx
14
+ // SVG (standard)
15
+ import { AccessTime24Filled } from '@fluentui/react-icons/svg/access-time';
16
+
17
+ // SVG sprites
18
+ import { AccessTime24Filled } from '@fluentui/react-icons/svg-sprite/access-time';
19
+
20
+ // Font icons
21
+ import { AccessTime24Filled } from '@fluentui/react-icons/fonts/access-time';
22
+
23
+ // Base API (SVG)
24
+ import { AccessTime24Filled } from '@fluentui/react-icons/base/svg/access-time';
25
+
26
+ // Base API (SVG sprites)
27
+ import { AccessTime24Filled } from '@fluentui/react-icons/base/svg-sprite/access-time';
28
+
29
+ // Base API (fonts)
30
+ import { AccessTime24Filled } from '@fluentui/react-icons/base/fonts/access-time';
31
+ ```
32
+
33
+ The examples below use `svg` as the target path. Replace it with the appropriate path for your setup from the list above.
34
+
35
+ ## Babel
36
+
37
+ Add [babel-plugin-transform-imports](https://www.npmjs.com/package/babel-plugin-transform-imports) with the following setup.
38
+
39
+ Copy the following helper into your project (e.g. as `fluent-icons-transform.js`):
40
+
41
+ ```js
42
+ // @filename fluent-icons-transform.js
43
+
44
+ /**
45
+ * Resolves a @fluentui/react-icons import name to its atomic module path.
46
+ * @param {string} importName - The named export being imported.
47
+ * @param {string} [target='svg'] - The target subpath (e.g. 'svg', 'svg-sprite', 'fonts',
48
+ * 'base/svg', 'base/svg-sprite', 'base/fonts').
49
+ * @returns {string} The resolved module path.
50
+ */
51
+ function resolveFluentIconImport(importName, target = 'svg') {
52
+ if (importName === 'useIconContext' || importName === 'IconDirectionContextProvider') {
53
+ return '@fluentui/react-icons/providers';
54
+ }
55
+
56
+ const match = importName.match(/^(.+?)(\d+)?(Regular|Filled|Light|Color)$/);
57
+ if (!match) {
58
+ return '@fluentui/react-icons/utils';
59
+ }
60
+
61
+ return `@fluentui/react-icons/${target}/${kebabCase(match[1])}`;
62
+ }
63
+
64
+ function kebabCase(str) {
65
+ return str.replace(/[a-z\d](?=[A-Z])|[a-zA-Z](?=\d)|[A-Z](?=[A-Z][a-z])/g, '$&-').toLowerCase();
66
+ }
67
+
68
+ module.exports = { resolveFluentIconImport };
69
+ ```
70
+
71
+ Then use it in your Babel config:
72
+
73
+ ```js
74
+ // @filename .babelrc.js
75
+ const { resolveFluentIconImport } = require('./fluent-icons-transform');
76
+
77
+ module.exports = {
78
+ presets: [
79
+ // ... your preset configuration
80
+ ],
81
+ plugins: [
82
+ [
83
+ 'transform-imports',
84
+ {
85
+ '@fluentui/react-icons': {
86
+ // Change the second argument to match your target:
87
+ // 'svg' | 'svg-sprite' | 'fonts' | 'base/svg' | 'base/svg-sprite' | 'base/fonts'
88
+ transform: (importName) => resolveFluentIconImport(importName, 'svg'),
89
+ preventFullImport: false,
90
+ skipDefaultConversion: true,
91
+ },
92
+ },
93
+ ],
94
+ ],
95
+ };
96
+ ```
97
+
98
+ ## SWC
99
+
100
+ Add [@swc/plugin-transform-imports](https://www.npmjs.com/package/@swc/plugin-transform-imports) with the following setup.
101
+
102
+ Replace every `svg` segment in the target paths below with your chosen target (`svg`, `svg-sprite`, `fonts`, `base/svg`, `base/svg-sprite`, or `base/fonts`):
103
+
104
+ ```jsonc
105
+ // @filename .swcrc
106
+ {
107
+ "jsc": {
108
+ "experimental": {
109
+ "plugins": [
110
+ [
111
+ "@swc/plugin-transform-imports",
112
+ {
113
+ "@fluentui/react-icons": {
114
+ "transform": [
115
+ // Transform provider imports to /providers
116
+ ["^(useIconContext|IconDirectionContextProvider)$", "@fluentui/react-icons/providers"],
117
+ // Transform icon imports to /{target}/{icon-name}
118
+ // (.+?) lazily captures the icon base name (may contain digits,
119
+ // e.g. "Space3D", "Rotate315Right"), (\d+)? greedily strips any
120
+ // trailing all-digit segment (size suffixes like 16/20/24, but
121
+ // also level indicators like Battery0) — this mirrors the
122
+ // normalizeBaseName logic used by the generation pipeline.
123
+ // {{ kebabCase }} on group 1 mirrors lodash.kebabCase.
124
+ [
125
+ "(.+?)(\\d+)?(Regular|Filled|Light|Color)$",
126
+ "@fluentui/react-icons/svg/{{ kebabCase memberMatches.[1] }}",
127
+ ],
128
+ // Fallback: all other exports are utilities
129
+ [".*", "@fluentui/react-icons/utils"],
130
+ ],
131
+ "preventFullImport": false,
132
+ "skipDefaultConversion": true,
133
+ "handleDefaultImport": false,
134
+ "handleNamespaceImport": false,
135
+ },
136
+ },
137
+ ],
138
+ ],
139
+ },
140
+ },
141
+ }
142
+ ```
@@ -0,0 +1,13 @@
1
+ # Preview Features
2
+
3
+ > **⚠️ Alpha** — these features are available as alpha prereleases only.
4
+ >
5
+ > Install via `npm i @fluentui/react-icons@alpha`
6
+
7
+ ## [Atomic API (SVG Sprites)](./svg-sprites.md)
8
+
9
+ SVG sprites offer smaller bundles, faster renders, and zero runtime overhead.
10
+
11
+ ## [Base API](./base.md)
12
+
13
+ A drop-in replacement for the standard API that removes the CSS-in-JS runtime — provides data-attribute selectors for styling behaviour with opt-in pre-defined vanilla CSS.
@@ -0,0 +1,184 @@
1
+ # Base API
2
+
3
+ > **⚠️ Alpha** — this feature is available as an alpha prerelease only.
4
+ >
5
+ > Install via `npm i @fluentui/react-icons@prerelease`
6
+
7
+ The Base API is a drop-in replacement for the standard icon API that removes the CSS-in-JS runtime dependency. It provides `data-*` attribute selectors for styling behaviour with opt-in pre-defined vanilla CSS — making it suitable for any React setup, including those without a CSS-in-JS runtime.
8
+
9
+ ## Benefits
10
+
11
+ - **No CSS-in-JS runtime** — removes the CSS-in-JS dependency entirely; styling is handled by an opt in plain CSS file or in user-land
12
+ - **Smaller JavaScript bundles** — icon styling code is moved from JS to a static CSS file
13
+ - **Framework-agnostic styling** — works in any environment that can load a CSS file (Vite, Next.js, Remix, etc.)
14
+ - **Same API surface** — `createFluentIcon`, `bundleIcon`, `useIconState`, and all constants work identically to the standard API
15
+ - **Migration-friendly** — works with both existing codebases (via build-time transforms) and greenfield projects (via direct imports)
16
+
17
+ ## How it works
18
+
19
+ The standard API uses Griffel's `makeStyles` / `mergeClasses` to inject CSS rules at runtime. The base API replaces this with HTML `data-*` attributes and a shipped CSS file (`base.css`) that targets them:
20
+
21
+ | Concern | Standard (Griffel) | Base (CSS) |
22
+ | --------------------- | ----------------------------------- | -------------------------------------------------------------------------- |
23
+ | Base icon layout | `useRootStyles()` → atomic classes | `[data-fui-icon] { display: inline; line-height: 0 }` |
24
+ | High-contrast mode | `@media (forced-colors)` in JS | `@media (forced-colors) { [data-fui-icon] { forced-color-adjust: auto } }` |
25
+ | RTL directional flip | `transform: scaleX(-1)` via Griffel | `[data-fui-icon-rtl] { transform: scaleX(-1) }` |
26
+ | bundleIcon visibility | Generated show/hide classes | `[data-fui-icon-hidden] { display: none }` |
27
+ | Font icon family | Griffel styles per variant | `[data-fui-icon-font="filled"] { font-family: '...' }` |
28
+
29
+ ## CSS Setup
30
+
31
+ You **must** import the base CSS file — this is the key difference from the standard API, which injects styles at runtime.
32
+
33
+ **For SVG icons and SVG sprites:**
34
+
35
+ ```ts
36
+ import '@fluentui/react-icons/base/base.css';
37
+ ```
38
+
39
+ **For font icons** (additionally):
40
+
41
+ ```ts
42
+ import '@fluentui/react-icons/base/base-fonts.css';
43
+ import '@fluentui/react-icons/base/base.css';
44
+ ```
45
+
46
+ > **Note:** `base-fonts.css` contains `@font-face` declarations with relative paths to the font files (`.woff2`, `.woff`, `.ttf`). Your bundler (webpack, Vite, esbuild) will resolve these into the dependency graph automatically, enabling font subsetting plugins to process them.
47
+
48
+ > **Tip 💡:** It's highly recommended to enable our [`react-icons-font-subsetting-webpack-plugin`](https://www.npmjs.com/package/@fluentui/react-icons-font-subsetting-webpack-plugin) to get same fonts "tree-shaking" perf boost
49
+
50
+ ## Usage
51
+
52
+ ### SVG Icons
53
+
54
+ Base SVG icons are grouped by icon kind and exposed via `@fluentui/react-icons/base/svg/{icon-group}`:
55
+
56
+ ```tsx
57
+ import '@fluentui/react-icons/base/base.css';
58
+
59
+ import {
60
+ AccessTime20Filled,
61
+ AccessTime24Filled,
62
+ AccessTime20Regular,
63
+ } from '@fluentui/react-icons/base/svg/access-time';
64
+ import { Add16Filled, Add20Filled } from '@fluentui/react-icons/base/svg/add';
65
+
66
+ function MyComponent() {
67
+ return (
68
+ <>
69
+ <AccessTime20Filled />
70
+ <Add16Filled />
71
+ </>
72
+ );
73
+ }
74
+ ```
75
+
76
+ ### SVG Sprites
77
+
78
+ Base SVG sprites work the same way as standard SVG sprites but without Griffel:
79
+
80
+ ```tsx
81
+ import '@fluentui/react-icons/base/base.css';
82
+
83
+ import { AccessTime20Filled, AccessTime24Filled } from '@fluentui/react-icons/base/svg-sprite/access-time';
84
+ import { Add16Filled } from '@fluentui/react-icons/base/svg-sprite/add';
85
+
86
+ function MyComponent() {
87
+ return (
88
+ <>
89
+ <AccessTime20Filled />
90
+ <Add16Filled />
91
+ </>
92
+ );
93
+ }
94
+ ```
95
+
96
+ > **Same-origin requirement:** Sprite files must be served from the same origin as your application. See the [SVG Sprites same-origin section](./svg-sprites.md#same-origin-requirement) for details.
97
+
98
+ ### Font Icons
99
+
100
+ Base font icons require both CSS files — `base.css` for base styles and `base-fonts.css` for `@font-face` declarations:
101
+
102
+ ```tsx
103
+ import '@fluentui/react-icons/base/base-fonts.css';
104
+ import '@fluentui/react-icons/base/base.css';
105
+
106
+ import { Airplane20Filled, Airplane24Regular } from '@fluentui/react-icons/base/fonts/airplane';
107
+
108
+ function MyComponent() {
109
+ return <Airplane20Filled />;
110
+ }
111
+ ```
112
+
113
+ ### Utilities
114
+
115
+ The base entry point (`@fluentui/react-icons/base`) re-exports all core utilities:
116
+
117
+ ```tsx
118
+ import {
119
+ // Icon factories
120
+ createFluentIcon,
121
+ bundleIcon,
122
+
123
+ // Core hook
124
+ useIconState,
125
+
126
+ // CSS class name constants (for consumer targeting)
127
+ iconClassName, // 'fui-Icon'
128
+ iconFilledClassName, // 'fui-Icon-filled'
129
+ iconRegularClassName, // 'fui-Icon-regular'
130
+ iconLightClassName, // 'fui-Icon-light'
131
+ iconColorClassName, // 'fui-Icon-color'
132
+ fontIconClassName, // 'fui-Icon-font'
133
+
134
+ // Data attribute constants
135
+ DATA_FUI_ICON, // 'data-fui-icon'
136
+ DATA_FUI_ICON_RTL, // 'data-fui-icon-rtl'
137
+ DATA_FUI_ICON_HIDDEN, // 'data-fui-icon-hidden'
138
+ DATA_FUI_ICON_FONT, // 'data-fui-icon-font'
139
+
140
+ // Context
141
+ IconDirectionContextProvider,
142
+ useIconContext,
143
+
144
+ // Class name helper
145
+ cx,
146
+ } from '@fluentui/react-icons/base';
147
+ ```
148
+
149
+ The `bundleIcon` function works identically to the standard API:
150
+
151
+ ```tsx
152
+ import '@fluentui/react-icons/base/base.css';
153
+ import { bundleIcon } from '@fluentui/react-icons/base';
154
+ import { AccessTimeFilled } from '@fluentui/react-icons/base/svg/access-time';
155
+ import { AccessTimeRegular } from '@fluentui/react-icons/base/svg/access-time';
156
+
157
+ const AccessTime = bundleIcon(AccessTimeFilled, AccessTimeRegular);
158
+
159
+ function MyComponent() {
160
+ return <AccessTime filled aria-label="Access time" />;
161
+ }
162
+ ```
163
+
164
+ ## TypeScript Configuration
165
+
166
+ **IMPORTANT**: TypeScript users must use `moduleResolution: "bundler"` (or `"node16"`/`"nodenext"`) in their `tsconfig.json` to properly resolve the base atomic exports:
167
+
168
+ ```json
169
+ {
170
+ "compilerOptions": {
171
+ "moduleResolution": "bundler"
172
+ }
173
+ }
174
+ ```
175
+
176
+ ## Build-Time Transform
177
+
178
+ You can keep root-level barrel imports and leverage build transforms to adopt the base API without modifying your source code. This works for both existing codebases migrating to base approach and greenfield projects.
179
+
180
+ Use `base/svg` as the target path (or `base/svg-sprite` for sprites, `base/fonts` for font icons).
181
+
182
+ > **Note:** You still need to manually add the CSS import (`import '@fluentui/react-icons/base/base.css'`) to your application entry point — build transforms only rewrite component imports.
183
+
184
+ 👉 **[Build-Time Transform setup (Babel & SWC) →](../build-transforms.md)**
@@ -0,0 +1,158 @@
1
+ # Atomic API (SVG Sprites)
2
+
3
+ > **⚠️ Alpha** — this feature is available as an alpha prerelease only.
4
+ >
5
+ > Install via `npm i @fluentui/react-icons@prerelease`
6
+
7
+ ## Benefits
8
+
9
+ - Smaller bundles, faster renders, zero runtime overhead, and no migration cost.
10
+ - If you use icons at scale, sprites can be considered the new default.
11
+
12
+ **📦 Bundle size wins**
13
+
14
+ With sprites, icons are deduplicated at the app level:
15
+
16
+ - The size savings increase with every additional icon you use
17
+ - Each icon definition exists only once for the entire application
18
+ - Icon code is removed from your JS bundles entirely
19
+
20
+ **⚡ Performance by design**
21
+
22
+ - Every icon exists once, outside of JS
23
+ - React re-renders are effectively no‑ops for icons
24
+ - Browsers give you an aggressive, free SVG storage cache, making repeated icon usage extremely cheap
25
+
26
+ ## How it works
27
+
28
+ Each icon component renders a lightweight `<svg><use href="/path/to/sprite.svg#icon-id" /></svg>` element. The actual icon paths live inside an external `.sprite.svg` file that the browser fetches, caches, and reuses across every render and page navigation. This completely removes icon rendering cost from your JavaScript bundle and React tree.
29
+
30
+ ## Same-origin requirement
31
+
32
+ > **Important:** Browsers block cross-origin SVG `<use href="...">` references due to security constraints — this is **not** a CORS header issue and cannot be solved by adding `Access-Control-Allow-Origin` headers alone.
33
+
34
+ The sprite files **must be served from the same origin** as your application. There are two straightforward ways to achieve this:
35
+
36
+ **Option 1 — Serve from your own static assets (recommended)**
37
+
38
+ Copy the sprite files into your application's public/static folder and reference them from your own domain. The [Webpack Subsetting Plugin](#webpack-plugin) handles this automatically at build time.
39
+
40
+ **Option 2 — Reverse proxy**
41
+
42
+ If the sprites are hosted on a CDN or separate server, configure your reverse proxy to forward requests under a same-origin path to that upstream. Example Nginx config:
43
+
44
+ ```nginx
45
+ # Proxy /sprites/ requests to the CDN while appearing same-origin to the browser
46
+ location /sprites/ {
47
+ proxy_pass https://your-cdn.example.com/sprites/;
48
+ proxy_cache_valid 200 30d;
49
+ add_header Cache-Control "public, max-age=2592000, immutable";
50
+ }
51
+ ```
52
+
53
+ After proxying, sprite URLs like `/sprites/access-time.sprite.svg` resolve from the same origin and the browser security restriction is lifted.
54
+
55
+ ## Usage
56
+
57
+ ### Direct API usage
58
+
59
+ Atomic SVG sprites, similarly to Atomic SVGs, are grouped by icon kind and exposed via `@fluentui/react-icons/svg-sprite/{icon-group}`.
60
+
61
+ ```ts
62
+ // Import individual icon variants from atomic icon groups
63
+ import {
64
+ AccessTime20Filled,
65
+ AccessTime24Filled,
66
+ AccessTime20Regular,
67
+ } from '@fluentui/react-icons/svg-sprite/access-time';
68
+ import { Add16Filled, Add20Filled } from '@fluentui/react-icons/svg-sprite/add';
69
+ ```
70
+
71
+ ### TypeScript Configuration
72
+
73
+ **IMPORTANT**: TypeScript users must use `moduleResolution: "bundler"` (or `"node16"`/`"nodenext"`) in their `tsconfig.json` to properly resolve these sprite exports:
74
+
75
+ ```json
76
+ {
77
+ "compilerOptions": {
78
+ "moduleResolution": "bundler"
79
+ }
80
+ }
81
+ ```
82
+
83
+ ### Build-Time Transform
84
+
85
+ You can keep root-level barrel imports and leverage build transforms to start using the new atomic sprites API.
86
+
87
+ Use `svg-sprite` as the target path.
88
+
89
+ 👉 **[Build-Time Transform setup (Babel & SWC) →](../build-transforms.md)**
90
+
91
+ ## Tooling
92
+
93
+ ### Webpack
94
+
95
+ Enable static asset processing for SVG files so the bundler emits them as separate URL-addressed resources:
96
+
97
+ ```js
98
+ const config = {
99
+ module: {
100
+ rules: [
101
+ {
102
+ test: /\.svg$/,
103
+ type: 'asset/resource',
104
+ },
105
+ ],
106
+ },
107
+ };
108
+ ```
109
+
110
+ ### Vite
111
+
112
+ Vite handles static assets out of the box. Ensure SVG files are **not** processed by any SVG-to-component plugin (such as `vite-plugin-svgr`) for sprite files, or scope such plugins to exclude `.sprite.svg`:
113
+
114
+ ```js
115
+ // vite.config.ts
116
+ import { defineConfig } from 'vite';
117
+
118
+ export default defineConfig({
119
+ plugins: [
120
+ // If you use vite-plugin-svgr, exclude sprite files:
121
+ // svgr({ include: /(?<!\.sprite)\.svg$/ }),
122
+ ],
123
+ // Sprite .svg files are served as static URLs automatically — no extra config needed.
124
+ });
125
+ ```
126
+
127
+ ### Webpack Plugin
128
+
129
+ > **⚠️ Alpha** — this package is available as an alpha prerelease only.
130
+ >
131
+ > Install via `npm i @fluentui/react-icons-svg-sprite-subsetting-webpack-plugin@prerelease`
132
+
133
+ To leverage performance benefits to the fullest, use the Webpack SvgSprite Subsetting Plugin. It analyzes your application's actual icon usage at build time and strips unused icon definitions from the sprite files — ensuring only icons your app references are shipped.
134
+
135
+ [Learn more about `react-icons-svg-sprite-subsetting-webpack-plugin`](https://www.npmjs.com/package/@fluentui/react-icons-svg-sprite-subsetting-webpack-plugin)
136
+
137
+ ```js
138
+ const {
139
+ default: FluentUIReactIconsSvgSpriteSubsettingPlugin,
140
+ } = require('@fluentui/react-icons-svg-sprite-subsetting-webpack-plugin');
141
+
142
+ const config = {
143
+ plugins: [
144
+ new FluentUIReactIconsSvgSpriteSubsettingPlugin({
145
+ /**
146
+ * 'atomic' (recommended) — one sprite file per icon group (e.g. access-time.sprite.svg).
147
+ * Best for HTTP/2 servers; browsers fetch only the groups your app actually uses and
148
+ * cache each group independently.
149
+ *
150
+ * 'merged' — all icons combined into a single sprite file.
151
+ * Useful when your app uses a large portion of the icon set and you prefer a single
152
+ * network request over many smaller ones.
153
+ */
154
+ mode: 'atomic', // or 'merged'
155
+ }),
156
+ ],
157
+ };
158
+ ```
@@ -8,9 +8,9 @@ export const CommentArrowLeft16Regular = ( /*#__PURE__*/createFluentIcon('Commen
8
8
  export const CommentArrowLeft16Filled = ( /*#__PURE__*/createFluentIcon('CommentArrowLeft16Filled', "16", ["M15 5.5a4.5 4.5 0 1 1-9 0 4.5 4.5 0 0 1 9 0Zm-6.85-.35A.5.5 0 0 0 8 5.5a.5.5 0 0 0 .15.35l2 2a.5.5 0 0 0 .7-.7L9.71 6h2.79a.5.5 0 0 0 0-1H9.7l1.15-1.15a.5.5 0 0 0-.7-.7l-2 2ZM10.5 11A5.5 5.5 0 0 0 15 8.66v.84a2.5 2.5 0 0 1-2.5 2.5H8.69l-3.06 2.68A.98.98 0 0 1 4 13.94V12h-.5A2.5 2.5 0 0 1 1 9.5v-5A2.5 2.5 0 0 1 3.5 2h2.76a5.5 5.5 0 0 0 4.24 9Z"], { flipInRtl: true }));
9
9
  export const CommentArrowLeft20Regular = ( /*#__PURE__*/createFluentIcon('CommentArrowLeft20Regular', "20", ["M19 5.5a4.5 4.5 0 1 1-9 0 4.5 4.5 0 0 1 9 0Zm-6.85-.35a.5.5 0 0 0-.15.35.5.5 0 0 0 .15.35l2 2a.5.5 0 0 0 .7-.7L13.71 6h2.79a.5.5 0 0 0 0-1h-2.8l1.15-1.15a.5.5 0 0 0-.7-.7l-2 2ZM17 12.28V10.4c.36-.18.7-.4 1-.66v2.54a2.58 2.58 0 0 1-2.6 2.56h-4.59L6.8 17.8a1 1 0 0 1-1.4-.2.98.98 0 0 1-.2-.59v-2.17h-.6A2.58 2.58 0 0 1 2 12.28V5.57A2.58 2.58 0 0 1 4.6 3h5c-.16.32-.3.65-.4 1H4.6C3.7 4 3 4.71 3 5.57v6.7c0 .86.7 1.57 1.6 1.57h1.6V17l4.28-3.16h4.92c.9 0 1.6-.71 1.6-1.56Z"], { flipInRtl: true }));
10
10
  export const CommentArrowLeft20Filled = ( /*#__PURE__*/createFluentIcon('CommentArrowLeft20Filled', "20", ["M19 5.5a4.5 4.5 0 1 1-9 0 4.5 4.5 0 0 1 9 0Zm-6.85-.35a.5.5 0 0 0-.15.35.5.5 0 0 0 .15.35l2 2a.5.5 0 0 0 .7-.7L13.71 6h2.79a.5.5 0 0 0 0-1h-2.8l1.15-1.15a.5.5 0 0 0-.7-.7l-2 2ZM14.5 11c1.33 0 2.55-.47 3.5-1.26v2.54a2.58 2.58 0 0 1-2.6 2.56h-4.59L6.8 17.8a1 1 0 0 1-1.4-.2.98.98 0 0 1-.2-.59v-2.17h-.6A2.58 2.58 0 0 1 2 12.28V5.57A2.58 2.58 0 0 1 4.6 3h5a5.5 5.5 0 0 0 4.9 8Z"], { flipInRtl: true }));
11
- export const CommentArrowLeft24Regular = ( /*#__PURE__*/createFluentIcon('CommentArrowLeft24Regular', "24", ["M12.02 3c-.3.46-.53.97-.7 1.5H5.24c-.97 0-1.75.78-1.75 1.75v8.5c0 .97.78 1.75 1.75 1.75H7.5v3.75l5.01-3.75h6.24c.97 0 1.75-.78 1.75-1.75v-2.48a6.52 6.52 0 0 0 1.5-1.08v3.56c0 1.8-1.46 3.25-3.25 3.25h-5.74L8 21.75a1.25 1.25 0 0 1-2-1V18h-.75A3.25 3.25 0 0 1 2 14.75v-8.5C2 4.45 3.46 3 5.25 3h6.77Zm5.48-2a5.5 5.5 0 1 1 0 11 5.5 5.5 0 0 1 0-11Zm-1.28 2.59-.07.06-2.53 2.53-.03.04-.04.07-.03.08-.02.08v.14l.02.06.03.06.03.06.04.05 2.53 2.53a.5.5 0 0 0 .76-.63l-.06-.07L15.21 7h5.29a.5.5 0 0 0 .5-.41V6.5a.5.5 0 0 0-.41-.5H15.2l1.65-1.65a.5.5 0 0 0 .06-.63l-.06-.07a.5.5 0 0 0-.63-.06Z"], { flipInRtl: true }));
12
- export const CommentArrowLeft24Filled = ( /*#__PURE__*/createFluentIcon('CommentArrowLeft24Filled', "24", ["M12.02 3A6.5 6.5 0 0 0 22 11.2v3.55c0 1.8-1.46 3.25-3.25 3.25h-5.79l-5.38 3.82A1 1 0 0 1 6 21v-3h-.75A3.25 3.25 0 0 1 2 14.75v-8.5C2 4.45 3.46 3 5.25 3h6.77Zm5.48-2a5.5 5.5 0 1 1 0 11 5.5 5.5 0 0 1 0-11Zm-1.28 2.59-.07.06-2.53 2.53-.03.04-.04.07-.03.08-.02.08v.14l.02.06.03.06.03.06.04.05 2.53 2.53a.5.5 0 0 0 .76-.63l-.06-.07L15.21 7h5.29a.5.5 0 0 0 .5-.41V6.5a.5.5 0 0 0-.41-.5H15.2l1.65-1.65a.5.5 0 0 0 .06-.63l-.06-.07a.5.5 0 0 0-.63-.06Z"], { flipInRtl: true }));
13
- export const CommentArrowLeft28Regular = ( /*#__PURE__*/createFluentIcon('CommentArrowLeft28Regular', "28", ["M27 6.5a5.5 5.5 0 1 1-11 0 5.5 5.5 0 0 1 11 0Zm-2.5.5a.5.5 0 0 0 0-1h-4.8l1.65-1.65a.5.5 0 0 0-.7-.7l-2.5 2.5a.5.5 0 0 0 0 .7l2.5 2.5a.5.5 0 0 0 .7-.7L19.71 7h4.79Zm0 10.25v-4.98a6.52 6.52 0 0 0 1.5-1.08v6.06A3.75 3.75 0 0 1 22.25 21h-5.94l-6.54 4.71C8.62 26.55 7 25.72 7 24.3V21H5.75A3.75 3.75 0 0 1 2 17.25V6.75A3.75 3.75 0 0 1 5.75 3h10.27c-.3.46-.53.97-.7 1.5H5.74c-1.24 0-2.25 1-2.25 2.25v10.5c0 1.24 1 2.25 2.25 2.25H8.5v4.8c0 .2.23.32.4.2l6.92-5h6.43c1.24 0 2.25-1 2.25-2.25Z"], { flipInRtl: true }));
14
- export const CommentArrowLeft28Filled = ( /*#__PURE__*/createFluentIcon('CommentArrowLeft28Filled', "28", ["M27 6.5a5.5 5.5 0 1 1-11 0 5.5 5.5 0 0 1 11 0Zm-2.5.5a.5.5 0 0 0 0-1h-4.8l1.65-1.65a.5.5 0 0 0-.7-.7l-2.5 2.5a.5.5 0 0 0 0 .7l2.5 2.5a.5.5 0 0 0 .7-.7L19.71 7h4.79Zm-3 6c1.75 0 3.33-.69 4.5-1.81v6.06A3.75 3.75 0 0 1 22.25 21h-5.94l-6.54 4.71C8.62 26.55 7 25.72 7 24.3V21H5.75A3.75 3.75 0 0 1 2 17.25V6.75A3.75 3.75 0 0 1 5.75 3h10.27a6.5 6.5 0 0 0 5.48 10Z"], { flipInRtl: true }));
11
+ export const CommentArrowLeft24Regular = ( /*#__PURE__*/createFluentIcon('CommentArrowLeft24Regular', "24", ["M17.5 12a5.5 5.5 0 1 1 0-11 5.5 5.5 0 0 1 0 11Zm3-5a.5.5 0 0 0 0-1h-4.8l1.65-1.65a.5.5 0 0 0-.7-.7l-2.5 2.5a.5.5 0 0 0 0 .7l2.5 2.5a.5.5 0 0 0 .7-.7L15.71 7h4.79Zm0 7.75v-2.48a6.52 6.52 0 0 0 1.5-1.08v3.56c0 1.8-1.46 3.25-3.25 3.25h-5.74L8 21.75a1.25 1.25 0 0 1-2-1V18h-.75A3.25 3.25 0 0 1 2 14.75v-8.5C2 4.45 3.46 3 5.25 3h6.77c-.3.46-.53.97-.7 1.5H5.24c-.97 0-1.75.78-1.75 1.75v8.5c0 .97.78 1.75 1.75 1.75H7.5v3.75l5.01-3.75h6.24c.97 0 1.75-.78 1.75-1.75Z"], { flipInRtl: true }));
12
+ export const CommentArrowLeft24Filled = ( /*#__PURE__*/createFluentIcon('CommentArrowLeft24Filled', "24", ["M17.5 12a5.5 5.5 0 1 1 0-11 5.5 5.5 0 0 1 0 11Zm3-5a.5.5 0 0 0 0-1h-4.8l1.65-1.65a.5.5 0 0 0-.7-.7l-2.5 2.5a.5.5 0 0 0 0 .7l2.5 2.5a.5.5 0 0 0 .7-.7L15.71 7h4.79Zm-3 6c1.75 0 3.33-.69 4.5-1.81v3.56c0 1.8-1.46 3.25-3.25 3.25H13l-5 3.75c-.82.62-2 .03-2-1V18h-.75A3.25 3.25 0 0 1 2 14.75v-8.5C2 4.45 3.46 3 5.25 3h6.77a6.5 6.5 0 0 0 5.48 10Z"], { flipInRtl: true }));
13
+ export const CommentArrowLeft28Regular = ( /*#__PURE__*/createFluentIcon('CommentArrowLeft28Regular', "28", ["M20.5 14a6.5 6.5 0 1 1 0-13 6.5 6.5 0 0 1 0 13Zm4-6a.5.5 0 0 0 0-1h-6.8l2.15-2.15a.5.5 0 0 0-.7-.7l-3 3a.5.5 0 0 0-.15.35c0 .13.05.26.15.35l3 3a.5.5 0 0 0 .7-.7L17.71 8h6.79Zm0 9.25v-3.4A7.54 7.54 0 0 0 26 12.6v4.65A3.75 3.75 0 0 1 22.25 21h-5.94l-6.54 4.71C8.62 26.55 7 25.72 7 24.3V21H5.75A3.75 3.75 0 0 1 2 17.25V6.75A3.75 3.75 0 0 1 5.75 3h8.75c-.35.46-.64.96-.88 1.5H5.75c-1.24 0-2.25 1-2.25 2.25v10.5c0 1.24 1 2.25 2.25 2.25H8.5v4.8c0 .2.23.32.4.2l6.92-5h6.43c1.24 0 2.25-1 2.25-2.25Z"], { flipInRtl: true }));
14
+ export const CommentArrowLeft28Filled = ( /*#__PURE__*/createFluentIcon('CommentArrowLeft28Filled', "28", ["M20.5 14a6.5 6.5 0 1 1 0-13 6.5 6.5 0 0 1 0 13Zm4-6a.5.5 0 0 0 0-1h-6.8l2.15-2.15a.5.5 0 0 0-.7-.7l-3 3a.5.5 0 0 0-.15.35c0 .13.05.26.15.35l3 3a.5.5 0 0 0 .7-.7L17.71 8h6.79Zm-4 7c2.17 0 4.13-.92 5.5-2.4v4.65A3.75 3.75 0 0 1 22.25 21h-5.94l-6.54 4.71C8.62 26.55 7 25.72 7 24.3V21H5.75A3.75 3.75 0 0 1 2 17.25V6.75A3.75 3.75 0 0 1 5.75 3h8.75a7.5 7.5 0 0 0 6 12Z"], { flipInRtl: true }));
15
15
  export const CommentArrowLeft48Regular = ( /*#__PURE__*/createFluentIcon('CommentArrowLeft48Regular', "48", ["M46 13a11 11 0 1 1-22 0 11 11 0 0 1 22 0ZM33.7 7.3a1 1 0 0 0-1.4 0l-5 5a1 1 0 0 0 0 1.4l5 5a1 1 0 0 0 1.4-1.4L30.42 14H42a1 1 0 1 0 0-2H30.41l3.3-3.3a1 1 0 0 0 0-1.4Zm7.8 21.45v-4.49c.9-.52 1.75-1.16 2.5-1.88v6.37c0 4-3.25 7.25-7.25 7.25H26.4l-10.85 7.66A2.25 2.25 0 0 1 12 41.82V36h-.75C7.25 36 4 32.75 4 28.75v-15.5C4 9.25 7.25 6 11.25 6h12.8c-.5.78-.92 1.62-1.25 2.5H11.25a4.75 4.75 0 0 0-4.75 4.75v15.5a4.75 4.75 0 0 0 4.75 4.75h3.25v7.84l11.1-7.84h11.15a4.75 4.75 0 0 0 4.75-4.75Z"], { flipInRtl: true }));
16
16
  export const CommentArrowLeft48Filled = ( /*#__PURE__*/createFluentIcon('CommentArrowLeft48Filled', "48", ["M46 13a11 11 0 1 1-22 0 11 11 0 0 1 22 0ZM33.7 7.3a1 1 0 0 0-1.4 0l-5 5a1 1 0 0 0 0 1.4l5 5a1 1 0 0 0 1.4-1.4L30.42 14H42a1 1 0 1 0 0-2H30.41l3.3-3.3a1 1 0 0 0 0-1.4ZM35 26c3.5 0 6.66-1.38 9-3.62v6.37c0 4-3.25 7.25-7.25 7.25H26.4l-10.85 7.66A2.25 2.25 0 0 1 12 41.82V36h-.75C7.25 36 4 32.75 4 28.75v-15.5C4 9.25 7.25 6 11.25 6h12.8A13 13 0 0 0 35 26Z"], { flipInRtl: true }));