On this page

Attachment

Live examples of Attachment, with the exact Vue file that renders each one.

Every example is a complete Vue file. Copy it into an app that has the registry installed.

Upload states

Done, uploading (the name shimmers), error (a red edge and the reason in words) and idle (a dashed edge, not sent yet). Actions are icon buttons named by their tooltip.

invoice-10482.pdfPDF · 184 KB
price-list-wholesale.xlsxUploading · 62%
stock-count-north.csvUpload failed: the file is larger than 10 MB.
delivery-note.pdfWaiting to upload
AttachmentStates.vue
<script setup lang="ts">
import { FileSpreadsheet, FileText, RotateCcw, TriangleAlert, X } from '@lucide/vue'
import {
  Attachment,
  AttachmentAction,
  AttachmentActions,
  AttachmentContent,
  AttachmentDescription,
  AttachmentMedia,
  AttachmentTitle,
} from '@/components/ui/attachment'
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from '@/components/ui/tooltip'
</script>

<template>
  <TooltipProvider>
    <div class="flex w-full max-w-100 flex-col gap-(--bh-space-100)">
      <Attachment>
        <AttachmentMedia><FileText /></AttachmentMedia>
        <AttachmentContent>
          <AttachmentTitle>invoice-10482.pdf</AttachmentTitle>
          <AttachmentDescription>PDF · 184 KB</AttachmentDescription>
        </AttachmentContent>
        <AttachmentActions>
          <Tooltip relationship="label">
            <TooltipTrigger as-child>
              <AttachmentAction><X /></AttachmentAction>
            </TooltipTrigger>
            <TooltipContent>Remove invoice-10482.pdf</TooltipContent>
          </Tooltip>
        </AttachmentActions>
      </Attachment>
      <Attachment state="uploading">
        <AttachmentMedia><FileSpreadsheet /></AttachmentMedia>
        <AttachmentContent>
          <AttachmentTitle>price-list-wholesale.xlsx</AttachmentTitle>
          <AttachmentDescription>Uploading · 62%</AttachmentDescription>
        </AttachmentContent>
      </Attachment>
      <Attachment state="error">
        <AttachmentMedia><TriangleAlert /></AttachmentMedia>
        <AttachmentContent>
          <AttachmentTitle>stock-count-north.csv</AttachmentTitle>
          <AttachmentDescription>Upload failed: the file is larger than 10 MB.</AttachmentDescription>
        </AttachmentContent>
        <AttachmentActions>
          <Tooltip relationship="label">
            <TooltipTrigger as-child>
              <AttachmentAction><RotateCcw /></AttachmentAction>
            </TooltipTrigger>
            <TooltipContent>Retry upload</TooltipContent>
          </Tooltip>
        </AttachmentActions>
      </Attachment>
      <Attachment state="idle">
        <AttachmentMedia><FileText /></AttachmentMedia>
        <AttachmentContent>
          <AttachmentTitle>delivery-note.pdf</AttachmentTitle>
          <AttachmentDescription>Waiting to upload</AttachmentDescription>
        </AttachmentContent>
      </Attachment>
    </div>
  </TooltipProvider>
</template>

Tiles in a row

orientation="vertical" with an AttachmentTrigger, so the whole tile opens the file. The row scrolls sideways and snaps to each tile. Tab to a tile: the focus ring goes around it.

invoice-10482.pdfPDF · 184 KB
price-list.xlsxXLSX · 42 KB
product-photo.pngPNG · 1.2 MB
delivery-note.pdfPDF · 96 KB
AttachmentTiles.vue
<script setup lang="ts">
import { FileSpreadsheet, FileText, Image as ImageIcon, X } from '@lucide/vue'
import {
  Attachment,
  AttachmentAction,
  AttachmentActions,
  AttachmentContent,
  AttachmentDescription,
  AttachmentGroup,
  AttachmentMedia,
  AttachmentTitle,
  AttachmentTrigger,
} from '@/components/ui/attachment'

const files = [
  { name: 'invoice-10482.pdf', meta: 'PDF · 184 KB', icon: FileText },
  { name: 'price-list.xlsx', meta: 'XLSX · 42 KB', icon: FileSpreadsheet },
  { name: 'product-photo.png', meta: 'PNG · 1.2 MB', icon: ImageIcon },
  { name: 'delivery-note.pdf', meta: 'PDF · 96 KB', icon: FileText },
]
</script>

<template>
  <AttachmentGroup class="w-full max-w-120" role="list" aria-label="Files on order 10482">
    <Attachment v-for="file in files" :key="file.name" orientation="vertical" role="listitem">
      <AttachmentTrigger :aria-label="`Open ${file.name}`" />
      <AttachmentMedia><component :is="file.icon" /></AttachmentMedia>
      <AttachmentContent>
        <AttachmentTitle>{{ file.name }}</AttachmentTitle>
        <AttachmentDescription>{{ file.meta }}</AttachmentDescription>
      </AttachmentContent>
      <AttachmentActions>
        <AttachmentAction :aria-label="`Remove ${file.name}`"><X /></AttachmentAction>
      </AttachmentActions>
    </Attachment>
  </AttachmentGroup>
</template>

Sizes

default, sm and xs. The tile is the control height of each size: 40, 32 and 24 px.

contract-crm-2026.pdfPDF · 184 KB
contract-crm-2026.pdfPDF · 184 KB
contract-crm-2026.pdf
AttachmentSizes.vue
<script setup lang="ts">
import { FileText } from '@lucide/vue'
import {
  Attachment,
  AttachmentContent,
  AttachmentDescription,
  AttachmentMedia,
  AttachmentTitle,
} from '@/components/ui/attachment'

const sizes = ['default', 'sm', 'xs'] as const
</script>

<template>
  <div class="flex flex-col items-start gap-(--bh-space-150)">
    <Attachment v-for="size in sizes" :key="size" :size="size">
      <AttachmentMedia><FileText /></AttachmentMedia>
      <AttachmentContent>
        <AttachmentTitle>contract-crm-2026.pdf</AttachmentTitle>
        <AttachmentDescription v-if="size !== 'xs'">PDF · 184 KB</AttachmentDescription>
      </AttachmentContent>
    </Attachment>
  </div>
</template>