Skip to content

Early previewhamur is not on npm yet. The components are being built in the open, follow along on GitHub.

UIComponentsReact

Attachment

A card for one file or image: its media, name, details, upload state and actions.

Rendered by React 19.3.1

attachment.tsx

Installation

npx shadcn@4.23.0 add https://hamur.dev/r/react/attachment.json

It also adds utils, button. The app needs its setup first: Installation.

Usage

Put AttachmentMedia (an icon, or variant="image" with an img), AttachmentContent (with AttachmentTitle and AttachmentDescription) and AttachmentActions (with AttachmentAction buttons) inside Attachment. state (idle, uploading, processing, error or done) dims the image, pulses the title and colours an error; size and orientation set the card's spacing and layout. AttachmentTrigger covers the card with one button or link; AttachmentGroup scrolls a row of attachments. The card shows a file; to pick or drop files, use File Upload.

import {
  Attachment,
  AttachmentGroup,
  AttachmentMedia,
  AttachmentContent,
  AttachmentTitle,
  AttachmentDescription,
  AttachmentActions,
  AttachmentAction,
  AttachmentTrigger,
} from '@/components/ui/attachment'

Examples

Default

A PDF being uploaded and an image, each removable.

Its preview and code are at the top of the page.

API reference

Attachment wraps no headless component of its own: its parts are elements with classes, and their props are the element's.