Attachment
A file or image attachment card with upload states, a spring collapse on removal, and a scrolling group.
Customize
Installation
npx shadcn@latest add @kinetic/attachmentUsage
Compose AttachmentMedia, AttachmentContent and AttachmentActions inside Attachment.
import { DocumentTextIcon, XMarkIcon } from "@heroicons/react/24/outline";
import {
Attachment,
AttachmentAction,
AttachmentActions,
AttachmentContent,
AttachmentDescription,
AttachmentMedia,
AttachmentTitle,
} from "@/components/kinetic/ui/attachment";
export function FileChip() {
return (
<Attachment>
<AttachmentMedia>
<DocumentTextIcon />
</AttachmentMedia>
<AttachmentContent>
<AttachmentTitle>report.pdf</AttachmentTitle>
<AttachmentDescription>PDF, 240 KB</AttachmentDescription>
</AttachmentContent>
<AttachmentActions>
<AttachmentAction aria-label="Remove file">
<XMarkIcon />
</AttachmentAction>
</AttachmentActions>
</Attachment>
);
}States
state picks the indicator in the media slot: idle, uploading, processing, error or done. Set showStatus={false} to hide it.
<Attachment state="uploading">...</Attachment>Removal
Set open={false} to collapse the card with a spring. onDismissComplete fires when it is gone, so you can drop it from your list.
<Attachment open={open} onDismissComplete={() => removeFile(file.id)}>
...
</Attachment>Size and layout
size is default, sm or xs; orientation="vertical" stacks a thumbnail above the text. AttachmentMedia variant="image" shows a cover image.
<Attachment orientation="vertical">
<AttachmentMedia variant="image">
<img src="/uploads/hero.png" alt="" />
</AttachmentMedia>
...
</Attachment>Group
AttachmentGroup lays cards out in a horizontal scroll strip with a staggered entrance. Use AttachmentTrigger with asChild to make a whole card open a link.
<AttachmentGroup>
<Attachment>...</Attachment>
<Attachment>...</Attachment>
</AttachmentGroup>Motion preferences
animated, speed, staggerMs and blurPx tune the lifecycle and group animations. Reduced motion shows and removes cards without animation.
API Reference
Attachment
Attachment card with media status indicators and spring dismissal.
| Prop | Type | Default | Description |
|---|---|---|---|
state | "idle" | "uploading" | "processing" | "error" | "done" | "done" | Selects the upload, processing, success, or error indicator in the media slot. |
size / orientation | "default" | "sm" | "xs" / "horizontal" | "vertical" | "default" / "horizontal" | Controls card padding density and inline row vs. vertical thumbnail layout. |
open / onDismissComplete | boolean / () => void | true | Drives Euler spring collapse when set to false and notifies after unmount cleanup. |
animated / showStatus / speed | boolean / boolean / number | true / true / 1 | Toggles lifecycle animations, status icon slot, and animation speed multiplier (clamped 0.25-4). |
AttachmentGroup
Horizontal scroll strip playing a capped staggered reveal across Attachment items.
| Prop | Type | Default | Description |
|---|---|---|---|
animated / staggerMs / blurPx / speed | boolean / number / number / number | true / 36 / 3 / 1 | Configures group entrance stagger (0-120ms, max 180ms), initial blur, and speed multiplier. |
AttachmentMedia / AttachmentAction / AttachmentTrigger / AttachmentContent / AttachmentTitle / AttachmentDescription / AttachmentActions
Media frame, Kinetic Button-backed action control, asChild trigger overlay, and text slots.
| Prop | Type | Default | Description |
|---|---|---|---|
variant (AttachmentMedia) | "icon" | "image" | "icon" | Renders a padded icon frame or full-bleed cover image thumbnail. |
size (AttachmentAction) | KineticButtonSize | "icon-xs" | "icon-sm" | Button size passed to Kinetic Button (maps icon-xs cleanly to icon-sm). |
asChild (AttachmentTrigger) | boolean | false | Merges full-card trigger behavior onto a single child link or element. |