Skip to Content
Liquid Glass UI
Components

Attachment

File and image attachment cards with Liquid Glass by default, supporting uploading, processing, error, and idle states, and automatically switching to Over-Glass inside message composers.

Fully compatible with the standard shadcn/ui JSX API (Attachment / AttachmentMedia / AttachmentContent / AttachmentTitle / AttachmentDescription / AttachmentActions / AttachmentAction / AttachmentTrigger / AttachmentGroup):

  • Default Liquid Glass: Renders with a Liquid Glass backdrop reacting to the global glass tint; pass glass={false} for a 100% opaque card.
  • Automatic Over-Glass switching: When nested inside a message composer (InputGroup), glass Card, or Dialog, automatically switches to an Over-Glass flat fill along with its inner remove button.
  • States: uploading / processing adds a shimmer to the title, error applies system red border and description text, and idle renders a dashed "Add attachment" placeholder.
  • Responsive sizing: 14px radius and 15px text on mobile ↔ 10px radius and 13px text on desktop; thumbnails use iOS / macOS Bordered system fills.
  • Horizontal scroll group: AttachmentGroup supports snap scrolling with edge fade masks and hidden scrollbars.
apple-liquid-ui/preview/attachment-demo
MacBook · 16:10

Installation (Shadcn Registry)

npx shadcn@latest add @apple-liquid/attachment

Image Attachments & Sizes

apple-liquid-ui/preview/attachment-gallery
MacBook · 16:10

Inside a Message Composer

Automatically adapts to Over-Glass inside a Liquid Glass InputGroup. Click × on an attachment to remove it, or + to restore:

apple-liquid-ui/preview/attachment-composer
MacBook · 16:10

Usage

import { FileTextIcon, XIcon } from 'lucide-react';
import {
  Attachment,
  AttachmentAction,
  AttachmentActions,
  AttachmentContent,
  AttachmentDescription,
  AttachmentMedia,
  AttachmentTitle,
} from '@/components/ui/attachment';

export function Example() {
  return (
    <Attachment>
      <AttachmentMedia>
        <FileTextIcon />
      </AttachmentMedia>
      <AttachmentContent>
        <AttachmentTitle>Design Spec.pdf</AttachmentTitle>
        <AttachmentDescription>PDF Document · 2.4 MB</AttachmentDescription>
      </AttachmentContent>
      <AttachmentActions>
        <AttachmentAction aria-label="Remove">
          <XIcon />
        </AttachmentAction>
      </AttachmentActions>
    </Attachment>
  );
}

Props API

Attachment

PropTypeDefaultDescription
state'idle' | 'uploading' | 'processing' | 'error' | 'done''done'Attachment status
size'default' | 'sm' | 'xs''default'Card density
orientation'horizontal' | 'vertical''horizontal'Horizontal file row or vertical thumbnail card
glassbooleantrueLiquid Glass material reacting to glass tint; false renders a 100% opaque surface. Automatically switches to Over-Glass on glass surfaces
surface'default' | 'over-glass'Auto-detectedManually override the hosting surface context

AttachmentMedia

PropTypeDefaultDescription
variant'icon' | 'image''icon'Icon tile or image thumbnail (semi-transparent while uploading)

AttachmentAction forwards all Button props (defaulting to variant="ghost", size="icon-xs"); AttachmentTrigger is a full-card transparent trigger supporting polymorphic render (e.g. as a link).

On this page