Skip to content
Focsd homeFocsd homeFocsd
Forms

Attachment tile

One attached file as a list item with its name, size and type icon.

  • Tag: focsd-attachment-tile
  • Pattern: List item with a remove button
  • Category: AI

Example

HTML
<div role="list" aria-label="Attachments">
<focsd-attachment-tile
name="report.pdf"
size="204800"
media-type="application/pdf"
removable></focsd-attachment-tile>
</div>

Usage

Import the module once, then use the tag like any HTML element. Every framework below renders the same element; see Frameworks for setup.

<script type="module">
import '@focsd-dev/ai';
</script>
<focsd-attachment-tile name="report.pdf" size="204800" media-type="application/pdf" removable></focsd-attachment-tile>

API

Attributes

AttributePropertyTypeDefault
namenamestring—
sizesizenumber—
media-typemediaTypestring—
removableremovablebooleanfalse
statusstatusAttachmentStatusready

CSS parts

Style the inside of the component with ::part(), for example focsd-attachment-tile::part(tile).

PartDescription
tileThe tile.
iconThe type icon.
nameThe file name.
sizeThe file size.
statusThe "Uploading" or "Upload failed" word.
removeThe remove button.

Accessibility

  • A list item (role="listitem") with the file name, its size (for example "200 KB") and an icon for its type that is hidden from assistive technology. Place tiles in a role="list".
  • The remove button is named "Remove report.pdf" and is at least 44 by 44 px; it fires focsd-attachment-remove with detail.name. The tile does not remove itself.
  • status is ready, uploading or error; uploading and failed uploads say so in words, not by color alone.

Keyboard

KeyAction
Enter / Space (remove button)Fire focsd-attachment-remove