Skip to content

[Feature]: Expand @fluentui/react-file-type-icons for use in React without Fluent UI v8 #26975

Description

@alina-zaieva

Library

React / v8 (@fluentui/react)

Describe the feature that you would like added

Overview

Our product (enterprise search in SharePoint, Office.com and Bing) uses @fluentui/react-file-type-icons package for showing file type icons. Currently we are refactoring our code to 1) remove dependencies on global icons set on window and 2) allow to use our own CDN for serving icons.

The issue that we hit is that the package does not export the default CDN URL and does not support constructing pure icon URL (only JSX or raw HTML) from file extension and/or type.

Proposal

  1. Export DEFAULT_BASE_URL from package's index as a part of export from initializeFileTypeIcons.tsx. This is to allow clients to switch between default and custom CDN URLs via e.g. flighting.
  2. Create a new exported function that would return file type icon URL based on IFileTypeIconOptions data and base URL. This will be similar to existing getFileTypeIconAsHTMLString.ts, but will simply return src URL instead of building HTML string. The function will then be available for use from React without having to use Icon component from Fluent UI v8.

Implementation

Draft PR: #27336

Have you discussed this feature with our team

No response

Additional context

No response

Validations

  • Check that there isn't already an issue that request the same feature to avoid creating a duplicate.

Metadata

Metadata

Assignees

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions