---
title: "Attachment"
description: "A file attachment for chat and upload interfaces, with a preview, title, description, and actions, in three sizes and two orientations."
plan: Free
docs: https://ui.edbn.me/docs/components/attachment
---

# Attachment

A file attachment for chat and upload interfaces, with a preview, title, description, and actions, in three sizes and two orientations.

## Installation

```bash
npx shadcn@4.19.0 add https://ui.edbn.me/r/attachment.json
```

## Dependencies
- npm: @base-ui/react@^1.8.0, class-variance-authority@^0.7.1
- edbn: edbn-base, button, progress

## Usage

```tsx examples/attachment-basic.tsx
"use client";
import { FileText, MoreHorizontal, X } from "lucide-react";
import {
  Attachment,
  AttachmentAction,
  AttachmentActions,
  AttachmentContent,
  AttachmentDescription,
  AttachmentMedia,
  AttachmentProgress,
  AttachmentTitle,
} from "@/components/ui/attachment";

export default function AttachmentBasicPreview() {
  return (
    <div className="flex flex-col gap-3">
      <Attachment>
        <AttachmentMedia>
          <FileText />
        </AttachmentMedia>
        <AttachmentContent>
          <AttachmentTitle>project-brief.md</AttachmentTitle>
          <AttachmentDescription>1.8 MB, uploaded</AttachmentDescription>
        </AttachmentContent>
        <AttachmentActions>
          <AttachmentAction aria-label="More attachment actions">
            <MoreHorizontal />
          </AttachmentAction>
        </AttachmentActions>
      </Attachment>
      <Attachment state="uploading">
        <AttachmentMedia>
          <FileText />
        </AttachmentMedia>
        <AttachmentContent>
          <AttachmentTitle>design-review.pdf</AttachmentTitle>
          <AttachmentDescription>2.4 MB, 64% uploaded</AttachmentDescription>
          <AttachmentProgress
            value={64}
            aria-label="Uploading design-review.pdf"
            className="mt-1.5"
          />
        </AttachmentContent>
        <AttachmentActions>
          <AttachmentAction aria-label="Cancel upload">
            <X />
          </AttachmentAction>
        </AttachmentActions>
      </Attachment>
    </div>
  );
}
```

## Files
- components/ui/attachment.tsx (231 lines)

## For agents
- Base theme, once per project: npx shadcn@4.19.0 add https://ui.edbn.me/r/edbn-base.json
- MCP server with search, items, examples and source: https://ui.edbn.me/mcp
- Every page and item: https://ui.edbn.me/llms.txt
