File icon
A page icon that shows the file type by colour, for file lists, attachments and downloads.
zb:file-icon zubazar/ui · free (MIT)
Types
BLADE
name takes the file name or just the extension; PDF is red, spreadsheets green, documents blue, slides orange, images purple, archives yellow, audio and video sky blue, others grey.
<div class="flex flex-wrap items-end gap-3">
<zb:file-icon name="invoice-2026-10.pdf" />
<zb:file-icon name="stock-list.xlsx" />
<zb:file-icon name="contract.docx" />
<zb:file-icon name="deck.pptx" />
<zb:file-icon name="product-photo.webp" />
<zb:file-icon name="backup.zip" />
<zb:file-icon name="promo.mp4" />
<zb:file-icon name="audit.log" />
</div>
| Prop | Values |
|---|---|
name | File name or extension |
In a file list
BLADE
Use the icon with the file's name and size; size sm · md · lg.
<ul class="divide-y divide-line rounded-sm border border-line bg-surface">
<li class="flex items-center gap-3 px-4 py-3">
<zb:file-icon name="invoice-2026-10.pdf" size="sm" />
<span class="min-w-0 flex-1 truncate text-sm">invoice-2026-10.pdf</span>
<span class="text-xs text-muted">284 KB</span>
</li>
<li class="flex items-center gap-3 px-4 py-3">
<zb:file-icon name="stock-list.xlsx" size="sm" />
<span class="min-w-0 flex-1 truncate text-sm">stock-list.xlsx</span>
<span class="text-xs text-muted">1.2 MB</span>
</li>
</ul>
| Prop | Values |
|---|---|
size | sm · md · lg |
Props
The values the component takes. What are props and slots?
| Prop | Type | Default | Description |
|---|---|---|---|
name | — | '' | File name or extension; the colour comes from the extension |
size | — | md | sm · md · lg |
Developer notes
- The colour comes from the extension; the icon is decorative, so write the file name next to it.