Import
tsx
import { Attachment } from "@indoku/ui"Examples
Basic usage
invoice-september.pdf
470.7 KB
rekap-penjualan.xlsx

workspace.png
PNG · 820.3 KB

desk-reference.jpg
JPG · 820.3 KB

office-reference.jpg
JPG · 820.3 KB
sales-dashboard.pdf
Uploading · 64%
rekap-penjualan.xlsx
tsx
Props
Root
| Prop | Type | Default | Description |
|---|---|---|---|
onClick | () => void | – | Click handler for the whole card (not the action buttons). Usually opens a preview. |
orientation | "horizontal" | "vertical" | horizontal | "vertical" renders a square card (thumbnail on top, name below). Pairs well with Attachment.Group. |
Media
| Prop | Type | Default | Description |
|---|---|---|---|
src | string | – | Thumbnail image URL. Without it, an icon based on kind is shown. |
alt | string | – | |
kind | "file" | "code" | file | Built-in icon: "file" or "code" (</>). Ignored when src is set. |
loading | boolean | – | Show a spinner (upload in progress). |
Meta
| Prop | Type | Default | Description |
|---|---|---|---|
size | number | – | File size in bytes. Formatted automatically (e.g. 1200000 → "1.1 MB"). |
format | string | – | Format label shown before the size, e.g. "PNG" → "PNG · 820 KB". |
Status
| Prop | Type | Default | Description |
|---|---|---|---|
status* | AttachmentStatus | – | |
progress | number | – | 0–100. Used when status is "uploading". |
variant | "bar" | "text" | bar | "bar" renders a progress bar. "text" renders "Uploading · 64%" (pair with <Attachment.Media loading />). |
Action
| Prop | Type | Default | Description |
|---|---|---|---|
"aria-label"* | string | – | Defines a string value that labels the current element. |
children | ReactNode | – |
* required. Style props and HTML attributes are accepted as well.
Created by @indokudev