Search documentation

Search the documentation and open a page.

Displays a file icon for common file types.

Loading...

Installation

pnpm dlx shadcn@latest add @wirekyt/file-icon

Composition

<app-file-icon />

Examples

Default

Loading...

Sizes

Loading...

Types

Loading...

API Reference

<app-file-icon>

The component renders an SVG. When type is omitted, it derives the icon type from the extension in name and falls back to "file" when the extension is unknown.

Inputs

InputTypeDefaultDescription
namestring""File name whose extension determines the icon when type is omitted.
typeFileIconType | undefinedinferredExplicitly selects the icon type instead of inferring it from name.
titlestring | undefined—Adds an SVG <title> and exposes the icon as an image to assistive technology.
aria-labelstring | undefined—Gives the rendered SVG an accessible name and exposes it as an image.
aria-labelledbystring | undefined—References the element that labels the SVG and exposes it as an image.
classstring""Adds classes to the rendered SVG alongside the component's cn-file-icon class.

FileIconType

type FileIconType = | "file" | "archive" | "document" | "spreadsheet" | "presentation" | "pdf" | "video" | "music" | "image";