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), glassCard, orDialog, automatically switches to an Over-Glass flat fill along with its inner remove button. - States:
uploading/processingadds a shimmer to the title,errorapplies system red border and description text, andidlerenders 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
Borderedsystem fills. - Horizontal scroll group:
AttachmentGroupsupports snap scrolling with edge fade masks and hidden scrollbars.
Installation (Shadcn Registry)
npx shadcn@latest add @apple-liquid/attachmentImage Attachments & Sizes
Inside a Message Composer
Automatically adapts to Over-Glass inside a Liquid Glass InputGroup. Click × on an attachment to remove it, or + to restore:
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
| Prop | Type | Default | Description |
|---|---|---|---|
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 |
glass | boolean | true | Liquid 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-detected | Manually override the hosting surface context |
AttachmentMedia
| Prop | Type | Default | Description |
|---|---|---|---|
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).
AspectRatio
Unstyled layout utility for displaying images, videos, or cards at a fixed aspect ratio using native CSS aspect-ratio.
Avatar
Apple 27 contact avatar with a 0.5px inner stroke to separate photos from light backgrounds, iOS Contacts-style gray gradient monogram fallbacks, 40px mobile ↔ 32px desktop sizing, status badges, and avatar groups.