Mime Type Icon

Displays appropriate icons for file names and MIME types using the Cubitt icon system.

Overview

MimeTypeIcon resolves an icon from either a MIME type or a file extension. Use it anywhere a file needs a compact visual identifier, such as attachment lists, upload flows, file cards, and document pickers.

Usage

import { MimeTypeIcon } from "@tilt-legal/cubitt-components/mime-type";
<MimeTypeIcon mimeType="application/pdf" />
<MimeTypeIcon fileName="document.docx" />
<MimeTypeIcon className="size-6" mimeType="image/png" />

Examples

MIME Types

File Names

Sizes

File List

Virtual File Icon

VirtualFileIcon renders the blank document shape with a consumer-provided icon centered on top. Use it for derived files, transcripts, summaries, or other virtual file types that do not map to a real MIME type.

import { VirtualFileIcon } from "@tilt-legal/cubitt-components/mime-type";
import { Scroll, Sparkle } from "@tilt-legal/cubitt-icons/ui/outline";

<VirtualFileIcon className="size-[62px]">
  <Scroll />
</VirtualFileIcon>

<VirtualFileIcon className="size-5">
  <Sparkle />
</VirtualFileIcon>

API Reference

MimeTypeIcon

PropTypeDefaultDescription
mimeTypestringMIME type to resolve, for example application/pdf.
fileNamestringFile name or extension to resolve, for example document.pdf or .pdf.
classNamestringAdditional classes. Use this for sizing, such as size-5.
sizenumber | stringExplicit size passed through to the underlying icon component.

Provide either mimeType or fileName. If both are provided, mimeType is tried first and fileName is used as a fallback.

VirtualFileIcon

PropTypeDefaultDescription
childrenReactNodeIcon to render centered on the blank document outline.
classNamestringAdditional classes. Use this for sizing, such as size-[62px].
sizenumber | stringExplicit size passed through to the blank document icon.

Supported File Types

MimeTypeIcon supports common document, image, video, audio, email, development, archive, and executable file types. Unknown MIME types or extensions render the generic blank file icon.

Documents

  • PDF, DOC, DOCX, XLS, XLSX, PPT, PPTX
  • TXT, CSV

Media

  • JPEG, JPG, PNG, GIF, SVG, WEBP, TIFF, ICO
  • MP4, AVI, MOV, MPG
  • MP3, WAV, AAC, FLAC, M4A, WMA

Other

  • EML, MSG
  • HTML, CSS, JS, JSON, JAVA
  • ZIP, RAR, DMG, EXE

On this page