# Attachment

> A file chip with upload progress and remove action.

- Category: [App & chat](https://tarve.dev/docs.md#chat)
- Import: `import { Attachment } from "@tarve/core";`
- Props type: `AttachmentProps`
- Source: [packages/core/src/chat-controls.ts:20](https://github.com/omarcosr/tarve/blob/main/packages/core/src/chat-controls.ts#L20)

## Usage

```tsx title="Attachment.tsx"
import { Attachment } from "@tarve/core";

<Attachment
  name="design-spec.pdf"
  size="2.4 MB"
  status="uploading"
  progress={62}
  onRemove={() => console.log("removed")}
/>
```

## Props

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `name` (required) | `string` | — |  |
| `leading` | `Child` | — |  |
| `onRemove` | `() => void` | — |  |
| `progress` | `number` | `0` |  |
| `removeLabel` | `string` | `"Remove"` |  |
| `size` | `string` | — |  |
| `status` | `AttachmentStatus` | `"ready"` |  |

## Common props

Shared by every component (descriptions: https://tarve.dev/docs.md#common-props): `children`, `class`, `className`, `highlight`, `id`, `key`, `motionFrom`, `onHighlight`, `onPaste`, `onPointerLeave`, `onPointerMove`, `onSize`, `onTransitionEnd`, `rovingGroup`, `style`.

## Types

```ts title="AttachmentStatus"
type AttachmentStatus = "ready" | "uploading" | "error";
```

Previous: [Marker](https://tarve.dev/docs/components/Marker.md) · Next: [Questionnaire](https://tarve.dev/docs/components/Questionnaire.md)

---

Tarve v0.13.8 · HTML version: https://tarve.dev/docs/components/Attachment · Index for agents: https://tarve.dev/llms.txt
