Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
121 commits
Select commit Hold shift + click to select a range
9fba299
Adding `portfolio` (Microsoft Project item type) to the list of non-f…
bigbadcapers Sep 23, 2024
63f928c
More filetype support.
bigbadcapers Sep 23, 2024
3ccf0e3
update CDN url and typo
bigbadcapers Sep 25, 2024
fab6a3a
yarn change
bigbadcapers Sep 25, 2024
55294b5
API update (from yarn nx run-many -t build)
bigbadcapers Sep 26, 2024
f025f9e
Merge branch 'master' into caperez/sep-filetype-icon-update
bigbadcapers Sep 26, 2024
bbeb40a
Ran `yarn nx format`
bigbadcapers Sep 26, 2024
0bcee33
Merge branch 'master' into caperez/sep-filetype-icon-update
bigbadcapers Sep 26, 2024
a7180bf
Merge branch 'caperez/sep-filetype-icon-update' of https://github.com…
bigbadcapers Sep 26, 2024
280fe2c
Changing FileIconType-based icon searching to use the same scalable m…
bigbadcapers Sep 29, 2024
d87a2a5
Merge branch 'upstream-master' into caperez/newTypeMethod
bigbadcapers Sep 30, 2024
d9cc656
removing stray outdated yarn change files
bigbadcapers Sep 30, 2024
a7884fb
yarn change
bigbadcapers Sep 30, 2024
b12c050
Ran `yarn nx format`
bigbadcapers Sep 30, 2024
71faacd
post-refactoring cleanup of an unused type
bigbadcapers Sep 30, 2024
d6b0c08
fixing error reported by `lint`: error The body of a for-in should b…
bigbadcapers Sep 30, 2024
60556e3
Merge branch 'master' into caperez/newTypeMethod
bigbadcapers Oct 1, 2024
5e51678
Merge branch 'master' into caperez/newTypeMethod
bigbadcapers Oct 1, 2024
348dc4d
Merge branch 'master' into caperez/newTypeMethod
bigbadcapers Oct 1, 2024
22c8545
Merge branch 'master' into caperez/newTypeMethod
bigbadcapers Oct 2, 2024
696661f
Merge branch 'master' into caperez/newTypeMethod
bigbadcapers Oct 3, 2024
fa910b5
Merge branch 'master' into caperez/newTypeMethod
bigbadcapers Oct 14, 2024
7e42ae8
Merge branch 'master' into caperez/newTypeMethod
bigbadcapers Oct 14, 2024
00bbcd6
Merge branch 'master' into caperez/newTypeMethod
bigbadcapers Oct 15, 2024
e49f620
Merge branch 'master' into caperez/newTypeMethod
bigbadcapers Oct 17, 2024
6640d15
Merge branch 'master' into caperez/newTypeMethod
bigbadcapers Oct 21, 2024
765313e
Merge branch 'master' into caperez/newTypeMethod
bigbadcapers Oct 22, 2024
0b1cf0b
Merge branch 'master' into caperez/newTypeMethod
bigbadcapers Oct 23, 2024
24c626f
Merge branch 'master' into caperez/newTypeMethod
bigbadcapers Oct 24, 2024
ae68e6d
Merge branch 'master' into caperez/newTypeMethod
bigbadcapers Oct 26, 2024
4b1d12e
Merge branch 'master' into caperez/newTypeMethod
bigbadcapers Oct 28, 2024
a41fc17
Merge branch 'upstream-master' into caperez/newTypeMethod
bigbadcapers Nov 1, 2024
b86c403
adding album entry to filetypeicon mapping
bigbadcapers Nov 1, 2024
b5a574c
Merge branch 'master' into caperez/newTypeMethod
bigbadcapers Nov 1, 2024
3fc8bc6
Merge branch 'master' into caperez/newTypeMethod
bigbadcapers Nov 8, 2024
4da5e8a
Merge remote-tracking branch 'upstream/master' into caperez/newTypeMe…
bigbadcapers Dec 20, 2024
856c284
Merge branch 'master' into caperez/newTypeMethod
bigbadcapers Dec 20, 2024
e1019ad
Merge branch 'master' into caperez/newTypeMethod
bigbadcapers Dec 23, 2024
d759bf1
Merge branch 'master' into caperez/newTypeMethod
bigbadcapers Jan 8, 2025
91b7b95
Merge branch 'master' into caperez/newTypeMethod
bigbadcapers Jan 8, 2025
fe0881e
Merge branch 'master' into caperez/newTypeMethod
bigbadcapers Jan 9, 2025
17bf0e5
Merge branch 'master' into caperez/newTypeMethod
bigbadcapers Jan 20, 2025
ddf6351
Merge branch 'master' into caperez/newTypeMethod
bigbadcapers Mar 10, 2025
e54435a
Merge branch 'master' into caperez/newTypeMethod
bigbadcapers Mar 13, 2025
54df488
Merge branch 'master' into caperez/newTypeMethod
bigbadcapers Mar 14, 2025
9f3c6da
Merge branch 'master' into caperez/newTypeMethod
bigbadcapers Mar 15, 2025
ada0165
Merge branch 'master' into caperez/newTypeMethod
bigbadcapers Apr 19, 2025
ad8552c
Merge branch 'master' into caperez/newTypeMethod
bigbadcapers Apr 30, 2025
d2c9ff6
Merge branch 'master' into caperez/newTypeMethod
bigbadcapers May 2, 2025
0af5721
Merge branch 'master' into caperez/newTypeMethod
bigbadcapers May 7, 2025
e7964db
Merge branch 'master' into caperez/newTypeMethod
bigbadcapers May 10, 2025
1aa9f16
Merge branch 'master' into caperez/newTypeMethod
bigbadcapers May 12, 2025
cbdba53
Merge branch 'master' into caperez/newTypeMethod
bigbadcapers May 14, 2025
19cd862
Merge branch 'master' into caperez/newTypeMethod
bigbadcapers Jun 5, 2025
209fd2c
Merge branch 'microsoft:master' into caperez/newTypeMethod
bigbadcapers Jul 29, 2025
aa8ffda
Merge branch 'master' into caperez/newTypeMethod
bigbadcapers Aug 22, 2025
f74d77b
Merge branch 'master' into caperez/newTypeMethod
bigbadcapers Oct 11, 2025
a19592f
first drop of creating a Fluent v9 version of the react-file-type-ico…
bigbadcapers Nov 23, 2025
0b1c4fb
refreshing filetype icon references in other storybooks to new icon s…
bigbadcapers Nov 23, 2025
ce3262c
more touch-ups in other places that reference the CDN url
bigbadcapers Nov 23, 2025
e08e1ba
verified new file-type-icons-preview package is rendering icons in th…
bigbadcapers Nov 23, 2025
641eb02
simplified documentation.
bigbadcapers Nov 23, 2025
59298fa
simplifying getFileTypeIconAsURL and getFileTypeIconAsHTMLString
bigbadcapers Nov 24, 2025
792e792
updated storybook / tests to evaluate helper functions
bigbadcapers Nov 24, 2025
3c64988
organizing storybook place in nav
bigbadcapers Nov 24, 2025
cbf2f29
Merge branch 'master' into caperez/newTypeMethod
bigbadcapers Nov 24, 2025
27a704e
Merge remote-tracking branch 'origin/caperez/newTypeMethod' into cape…
bigbadcapers Nov 24, 2025
8d379e6
update getFileTypeIconProps to use same mapping file FileTypeIconMap.…
bigbadcapers Nov 24, 2025
e51a9c6
new documentation pass 1 (broken)
bigbadcapers Nov 24, 2025
213d6f0
documentation rendering ok, ready to condense
bigbadcapers Nov 24, 2025
f0a02bf
refining FileIconType and storybook
bigbadcapers Nov 24, 2025
71338bf
story condensation snapshot
bigbadcapers Nov 25, 2025
93a577b
condensation 2
bigbadcapers Nov 25, 2025
3d484ae
improving alt tag generation in the control itself, removing a11y sto…
bigbadcapers Nov 25, 2025
199803c
ran all pre-checks from plan-testingAndPromotionEnhanced. ready to st…
bigbadcapers Nov 25, 2025
325af7b
package move to remove -preview suffix
bigbadcapers Nov 25, 2025
092682f
first test passed after package rename
bigbadcapers Nov 25, 2025
f5b16cc
API update and undoing newFileTypeMethod in v8 package
bigbadcapers Nov 25, 2025
baa3430
package semver cleanup, build pass, documentation simplification
bigbadcapers Nov 25, 2025
1f48612
error checking and optimizations
bigbadcapers Nov 25, 2025
5996d70
initializeFileTypeIcons with alternate CDN URL is now honored by new …
bigbadcapers Nov 25, 2025
e89bd7b
improved icon size checking, removing unnecessary public exports, fix…
bigbadcapers Nov 25, 2025
917c256
Merge branch 'master' into caperez/filetype-icons-for-v9
bigbadcapers Nov 25, 2025
9af6811
cleanup stray API file
bigbadcapers Nov 25, 2025
fb25605
Merge branch 'caperez/filetype-icons-for-v9' of https://github.com/bi…
bigbadcapers Nov 25, 2025
df430ed
changing v8 package name and adding publishConfig so it emits to the …
bigbadcapers Nov 25, 2025
0204824
updating swc packages and lint tweaks
bigbadcapers Nov 25, 2025
3b2ed13
yarn change
bigbadcapers Nov 25, 2025
c5b3ca1
Merge branch 'master' into caperez/filetype-icons-for-v9
bigbadcapers Nov 25, 2025
07d1b03
remove private flag from package.json for react-file-type-icons
bigbadcapers Nov 25, 2025
b2a45e8
Merge branch 'caperez/filetype-icons-for-v9' of https://github.com/bi…
bigbadcapers Nov 25, 2025
3794169
deduplicating yarn lock and solving plugin issue in react-utilities .…
bigbadcapers Nov 25, 2025
935f967
yarn change for react-utilities
bigbadcapers Nov 25, 2025
237b828
npx yarn-deduplicate --strategy fewer
bigbadcapers Nov 25, 2025
cb42047
Add path mapping for react-file-type-icons-v8 in tsconfig.base.all.json
bigbadcapers Nov 25, 2025
cfa9fba
re-running yarn nx format:write
bigbadcapers Nov 25, 2025
ef929f1
undoing removal of indent rule
bigbadcapers Nov 25, 2025
9824a02
plugin swc-plugin-de-indent-template-literal is crashing, removing
bigbadcapers Nov 25, 2025
9b0917c
yarn change for experimental swc.rs indentation plugin removal
bigbadcapers Nov 25, 2025
2d73b85
fix missing param in documentation for getFileTypeIcon
bigbadcapers Nov 25, 2025
13974b7
Add missing dependency and update styles in file type icon stories
bigbadcapers Nov 26, 2025
d949974
lint and yarn change again
bigbadcapers Nov 26, 2025
2d6e940
undoing overeager deletion of a file i had no business touching
bigbadcapers Nov 26, 2025
ba6015c
fixing compilation config issues - no change
bigbadcapers Nov 26, 2025
c2ad25a
Refactor UrlAndHtml component export and update story parameters
bigbadcapers Nov 26, 2025
c31ef7e
Add device pixel ratio state and effect to UrlAndHtml component to pa…
bigbadcapers Nov 26, 2025
6c94223
yarn nx format:write prettier
bigbadcapers Nov 26, 2025
917f878
dead end ci/cd solving ci/main no dice
bigbadcapers Nov 26, 2025
ae682cc
Merge branch 'master' into caperez/filetype-icons-for-v9
bigbadcapers Nov 26, 2025
f1984d1
first late undo
bigbadcapers Nov 26, 2025
cb3066c
Merge branch 'caperez/filetype-icons-for-v9' of https://github.com/bi…
bigbadcapers Nov 26, 2025
f55e035
attempted reset
bigbadcapers Nov 26, 2025
15c87a6
yarn change in shared-contexts
bigbadcapers Nov 26, 2025
6bfae2c
Merge branch 'master' into caperez/filetype-icons-for-v9
bigbadcapers Nov 26, 2025
a0f11fd
Merge branch 'master' into caperez/filetype-icons-for-v9
bigbadcapers Nov 26, 2025
921aeff
chore: update package dependencies for react and charting components
bigbadcapers Nov 26, 2025
32e1197
Merge branch 'master' into caperez/filetype-icons-for-v9
bigbadcapers Nov 26, 2025
91ed548
feat: add public docsite setup for v8 version of file-type-icons package
bigbadcapers Nov 26, 2025
47aec0f
Merge branch 'master' into caperez/filetype-icons-for-v9
bigbadcapers Dec 1, 2025
17569a9
Merge branch 'master' into caperez/filetype-icons-for-v9
bigbadcapers Dec 2, 2025
e740fbf
Merge branch 'master' into caperez/filetype-icons-for-v9
bigbadcapers Dec 2, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,8 @@ packages/react-components/component-selector-preview/library @microsoft/teams-pr
packages/react-components/component-selector-preview/stories @microsoft/teams-prg
packages/react-components/react-menu-grid-preview/library @microsoft/teams-prg
packages/react-components/react-menu-grid-preview/stories @microsoft/teams-prg
packages/react-components/react-file-type-icons/library @microsoft/cxe-red @jahnp @bigbadcapers
packages/react-components/react-file-type-icons/stories @microsoft/cxe-red @jahnp @bigbadcapers
# <%= NX-CODEOWNER-PLACEHOLDER %>

# Deprecated v9 packages - exposed as part of `/unstable` api
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@

[![Build Status](https://img.shields.io/azure-devops/build/uifabric/fabricpublic/164/master?style=flat-square)](https://dev.azure.com/uifabric/fabricpublic/_build?definitionId=164) ![GitHub contributors](https://img.shields.io/github/contributors/microsoft/fluentui?style=flat-square) ![GitHub top language](https://img.shields.io/github/languages/top/microsoft/fluentui?style=flat-square) [![Twitter Follow](https://img.shields.io/twitter/follow/fluentui?logo=x&style=flat-square)](https://twitter.com/FluentUI?ref_src=twsrc%5Etfw)

> Fluent UI React is shipping its v9 final stable release. Visit the [Fluent UI React v9 Release page on the wiki](https://github.com/microsoft/fluentui/wiki/Fluent-UI-React-v9-Release) to learn more about the upcoming release schedule.

Fluent UI web represents a collection of utilities, React components, and Web Components for building web applications.
Fluent UI is a collection of utilities and React components for building web applications.

This repo is home to 3 separate projects today. Combining Fluent UI React v9 components with Fluent UI React v8 or v0 components is possible and allows gradual migration to Fluent UI v9.

Expand All @@ -27,6 +25,8 @@ The following table will help you navigate the 3 projects and understand their d

> Why are there two React versions? Fluent UI v8 is still widely used. We encourage you to migrate to Fluent UI v9. See the [Migration overview](https://react.fluentui.dev/?path=/docs/concepts-migration-from-v8-component-mapping--docs).

For docs on how to contribute to our repo, check out the [contributing docs](https://github.com/microsoft/fluentui/tree/master/docs/react-v9/contributing) folder.

## FluentUI Insights

[Fluent UI Insights](https://docs.microsoft.com/en-us/shows/fluent-ui-insights?utm_source=github) is a series that describes the design and decisions behind the Fluent UI design system.
Expand Down
2 changes: 1 addition & 1 deletion apps/pr-deploy-site/chiclet-test.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
/>
<meta
property="og:image"
content="https://res-1.cdn.office.net/files/fabric-cdn-prod_20230815.002/assets/item-types/48/docx.svg"
content="https://res.cdn.office.net/files/fabric-cdn-prod_20251119.001/assets/item-types/48/docx.svg"
/>

<title>Chiclet Test Page</title>
Expand Down
2 changes: 1 addition & 1 deletion apps/public-docsite/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
"@fluentui/react-examples": "*",
"@fluentui/react-experiments": "*",
"@fluentui/fluent2-theme": "*",
"@fluentui/react-file-type-icons": "*",
"@fluentui/react-file-type-icons-v8": "*",
"@fluentui/react-icons-mdl2": "*",
"@fluentui/react-icons-mdl2-branded": "*",
"@fluentui/set-version": "*",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as React from 'react';
import { Icon, Link } from '@fluentui/react';
import { getFileTypeIconProps } from '@fluentui/react-file-type-icons';
import { getFileTypeIconProps } from '@fluentui/react-file-type-icons-v8';
import { Markdown, MarkdownHeader, IPageSectionProps } from '@fluentui/react-docsite-components/lib/index2';
import { IStylesPageProps, StylesAreaPage } from '../StylesAreaPage';
import { FileTypeIconsPageProps } from './FileTypeIconsPage.doc';
Expand Down
2 changes: 1 addition & 1 deletion apps/public-docsite/src/root.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { registerIcons, on, KeyCodes, setRTL } from '@fluentui/react';
import { initializeFileTypeIcons } from '@fluentui/react-file-type-icons';
import { initializeFileTypeIcons } from '@fluentui/react-file-type-icons-v8';
import { createSite } from './utilities/createSite';
import * as platformPickerStyles from '@fluentui/react-docsite-components/lib/components/PlatformPicker/PlatformPicker.module.scss';
import { SiteDefinition } from './SiteDefinition/index';
Expand Down
2 changes: 1 addition & 1 deletion apps/vr-tests/src/stories/Tile.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ export const DocumentTileWithIcon = () => (
itemActivity={<SignalField before={<SharedSignal />}>{'Test Activity'}</SignalField>}
foreground={
<img
src="https://res-1.cdn.office.net/files/fabric-cdn-prod_20230815.002/assets/item-types/48/docx.svg"
src="https://res.cdn.office.net/files/fabric-cdn-prod_20251119.001/assets/item-types/48/docx.svg"
style={{
display: 'block',
width: '64px',
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "patch",
"comment": "Associating this older public docsite with the v8 version of the file-type-icons package (new workspace name got -v8 suffix added)",
"packageName": "@fluentui/public-docsite-setup",
"email": "caperez@microsoft.com",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "minor",
"comment": "Adding react-file-type-icons package for FluentUI v9",
"packageName": "@fluentui/react-components",
"email": "caperez@microsoft.com",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "minor",
"comment": "\u0016\u0016\u0016Chagnging FileIconType-based icon searchign to use the same scalable method used for file extensions",
"packageName": "@fluentui/react-file-type-icons",
"email": "caperez@microsoft.com",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "minor",
"comment": "Adding react-file-type-icons package for FluentUI v9. This package is now suffixed with v8 in the repo, but published to the same @fluentui/react-file-type-icons namespace in NPM with no suffix, just retaining the 8.x.x semver.",
"packageName": "@fluentui/react-file-type-icons-v8",
"email": "caperez@microsoft.com",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "patch",
"comment": "including package react-file-type-icons v9",
"packageName": "@fluentui/react-shared-contexts",
"email": "caperez@microsoft.com",
"dependentChangeType": "patch"
}
3 changes: 1 addition & 2 deletions packages/public-docsite-setup/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,5 @@
"devDependencies": {
"@fluentui/eslint-plugin": "*",
"@fluentui/scripts-tasks": "*"
},
"dependencies": {}
}
}
3 changes: 2 additions & 1 deletion packages/react-components/react-components/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,8 @@
"@fluentui/react-motion": "^9.11.4",
"@fluentui/react-carousel": "^9.8.12",
"@fluentui/react-color-picker": "^9.2.11",
"@fluentui/react-nav": "^9.3.14"
"@fluentui/react-nav": "^9.3.14",
"@fluentui/react-file-type-icons": "^9.0.0"
},
"peerDependencies": {
"@types/react": ">=16.14.0 <20.0.0",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"extends": "../../../../.babelrc-v9.json",
"plugins": ["annotate-pure-calls", "@babel/transform-react-pure-annotations"]
}
30 changes: 30 additions & 0 deletions packages/react-components/react-file-type-icons/library/.swcrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"$schema": "https://json.schemastore.org/swcrc",
"exclude": [
"/testing",
"/**/*.cy.ts",
"/**/*.cy.tsx",
"/**/*.spec.ts",
"/**/*.spec.tsx",
"/**/*.test.ts",
"/**/*.test.tsx"
],
"jsc": {
"parser": {
"syntax": "typescript",
"tsx": true,
"decorators": false,
"dynamicImport": false
},
"externalHelpers": true,
"transform": {
"react": {
"runtime": "classic",
"useSpread": true
}
},
"target": "es2019"
},
"minify": false,
"sourceMaps": true
}
15 changes: 15 additions & 0 deletions packages/react-components/react-file-type-icons/library/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
@fluentui/react-file-type-icons

Copyright (c) Microsoft Corporation

All rights reserved.

MIT License

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ""Software""), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED _AS IS_, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Note: Usage of the fonts and icons referenced in Fluent UI React is subject to the terms listed at https://aka.ms/fluentui-assets-license
142 changes: 142 additions & 0 deletions packages/react-components/react-file-type-icons/library/MIGRATION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
# Migration Guide: react-file-type-icons to react-file-type-icons

This guide helps you migrate from `@fluentui/react-file-type-icons` (v8) to `@fluentui/react-file-type-icons` (v9).

## Overview

The v9 version provides a **modern React component-based API** while maintaining **full backward compatibility** with all v8 utility functions.

**Key Points:**

- ✅ All v8 utilities exported and work identically
- ✅ No breaking API changes for utility functions
- 🆕 New component API available (recommended but optional)

## Installation

```bash
npm install @fluentui/react-file-type-icons
```

## What's Changed

### Package Name (Breaking Change)

The only breaking change is the package name:

- **Old**: `@fluentui/react-file-type-icons`
- **New**: `@fluentui/react-file-type-icons`

### New Component API (Recommended)

**v8 (utility-based) - Still works:**

```tsx
import { getFileTypeIconProps } from '@fluentui/react-file-type-icons';

const iconProps = getFileTypeIconProps({ extension: 'docx', size: 48 });
<img src={iconProps.iconName} alt="Document" />;
```

**v9 (component-based) - Recommended:**

```tsx
import { FileTypeIcon } from '@fluentui/react-file-type-icons';

<FileTypeIcon extension="docx" size={48} />;
```

## Migration Examples

### Document Icons

**Before:**

```tsx
import { getFileTypeIconProps } from '@fluentui/react-file-type-icons';

function DocumentItem({ filename }) {
const extension = filename.split('.').pop();
const iconProps = getFileTypeIconProps({ extension, size: 32 });

return (
<div>
<img src={iconProps.iconName} alt={filename} style={{ width: 32, height: 32 }} />
<span>{filename}</span>
</div>
);
}
```

**After:**

```tsx
import { FileTypeIcon } from '@fluentui/react-file-type-icons';

function DocumentItem({ filename }) {
const extension = filename.split('.').pop();

return (
<div>
<FileTypeIcon extension={extension} size={32} />
<span>{filename}</span>
</div>
);
}
```

### Folder Icons

**Before:**

```tsx
import { getFileTypeIconProps, FileIconType } from '@fluentui/react-file-type-icons';

const iconProps = getFileTypeIconProps({ type: FileIconType.folder, size: 48 });
<img src={iconProps.iconName} alt="Folder" />;
```

**After:**

```tsx
import { FileTypeIcon, FileIconType } from '@fluentui/react-file-type-icons';

<FileTypeIcon type={FileIconType.folder} size={48} />;
```

## Incremental Migration

**You don't have to migrate all code at once!** All v8 utilities work identically in v9:

```tsx
import {
FileTypeIcon, // v9 component (new)
getFileTypeIconAsUrl, // v8 utility (still works)
} from '@fluentui/react-file-type-icons';

function MyComponent() {
return (
<div>
{/* Old code - still works */}
<img src={getFileTypeIconAsUrl({ extension: 'docx', size: 32 })} alt="Document" />

{/* New code - recommended */}
<FileTypeIcon extension="docx" size={32} />
</div>
);
}
```

## Benefits of the New Component API

1. **Simpler** - No manual URL handling or img element construction
2. **Better TypeScript** - Full type safety with v9's type definitions
3. **Accessible** - Built-in alt text and ARIA support
4. **Optimized** - Automatic pixel ratio and format handling

## Need Help?

If you encounter issues:

1. Check the [Storybook examples](https://aka.ms/fluentui-storybook)
2. Open an issue on [GitHub](https://github.com/microsoft/fluentui)
Loading