1.4.0 • Published 4 months ago

react-file-icon v1.4.0

Weekly downloads
28,675
License
MIT
Repository
github
Last release
4 months ago

React File Icon

npm version gh workflow

CodeSandbox demo with default icon styles.

import { FileIcon } from 'react-file-icon';

Props

PropertyTypeDefaultDescription
colorstringwhitesmokeColor of icon background
extensionstringundefinedText to display in label
foldbooltrueDisplays the corner fold
foldColorstringundefinedColor of the corner fold
glyphColorstringundefinedColor of file type icon
gradientColorstringwhiteColor of page gradient
gradientOpacitynumber0.25Opacity of page gradient
labelColorstringundefinedColor of label
labelTextColorstringwhiteColor of label text
labelUppercaseboolfalseDisplays the label in all caps
radiusnumber4Corner radius of the file icon
typeenumundefinedType of glyph icon to display (One of: 3d, acrobat, android, audio, binary, code, compressed, document, drive, font, image, presentation, settings, spreadsheet, vector, video)

Default Styles

We also export an object of default styles that can be used as a starting point when rendering icons. Object keys map to file extensions.

import { FileIcon, defaultStyles } from 'react-file-icon';

// Render a .docx icon with default styles
<FileIcon extension="docx" {...defaultStyles.docx} />;