0.3.1 • Published 8 months ago

astro-file-icon v0.3.1

Weekly downloads
-
License
MIT
Repository
github
Last release
8 months ago

Astro File Icon

Astro component that display icon of file by it's extension. Based on react-file-icon.

Take a look at astro-file-icon.pages.dev to view the default icon styles.

Installation

pnpm install astro-file-icon
# Or
yarn add astro-file-icon
# Or
npm install astro-file-icon
import { FileIcon } from "astro-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, 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} />;