Skip to content
HomeCobalt

File type icon

Tells a person what kind of file they are looking at, such as a PDF or a spreadsheet, and shows in the same place how far the file's upload has gone or that it failed.

Examples

The ten kinds, each from a file's name: a sheet with a folded corner in its kind's colour and a plain white mark. A file of no known kind is grey.
  • Brief.pdf
  • Memo.docx
  • Fund.xlsx
  • Deck.pptx
  • Photo.jpg
  • Call.m4a
  • Tour.mp4
  • Export.zip
  • Loader.ts
  • Readme
FailedThe same file uploaded and failed. A failed upload keeps the sheet grey and swaps its mark for the retry arrow. The glyph stays a picture; the part that holds it makes it the Retry button, as FileTile does.
UploadingAn upload drawn on the glyph: grey at first, its colour rising from the bottom as the share grows, and the grey breathing while the share is not known. While it uploads the glyph is the progress bar, named by what is uploading.
PDF
In an itemFiles in a list of rows: the glyph is the row's media, at the height of the two lines beside it.
  • Form ADV Part 2A.pdf
    Filed by Harbour Capital
    Mar 3
  • Q3 holdings.xlsx
    Shared by Ada Park
    Oct 2
  • Due diligence notes.docx
    Edited by Tomás Reyes
    Sep 28

Usage

Use it when

  • A file sits beside its name in a list, a message, an attachment or a bar, and the reader should see its kind at a glance.
  • A file is uploading or failed to upload, and the glyph beside its name should show it.

Use something else when

  • The whole file row, with its name, its size or upload line and its actions. Use FileTile instead, which draws this glyph with them.
  • The file is a picture the reader should see. Use FileTile instead, with src, which draws the picture as its own thumbnail.
  • The place where files are chosen or dropped. Use FileDrop instead.

Rules

General

Content

Avoid

Install

npx shadcn@latest add https://kaanarici.com/r/cobalt/file-type-icon.json
import { FileTypeIcon } from "@/components/cobalt/ui/file-type-icon"