Redpanda UIRedpanda UI
Components

Attachment

Displays a file or image attachment with media, metadata, upload state, and actions.

Made by shadcn
Loading component...

Powered by

Installation

Usage

Use Attachment for files and images in chat composers, message threads, and upload lists.

import {
  Attachment,
  AttachmentAction,
  AttachmentActions,
  AttachmentContent,
  AttachmentDescription,
  AttachmentMedia,
  AttachmentTitle,
  AttachmentTrigger,
} from "@/components/redpanda-ui/components/attachment"
<Attachment state="uploading">
  <AttachmentMedia><FileTextIcon /></AttachmentMedia>
  <AttachmentContent>
    <AttachmentTitle>report.pdf</AttachmentTitle>
    <AttachmentDescription>Uploading · 64%</AttachmentDescription>
  </AttachmentContent>
  <AttachmentActions>
    <AttachmentAction aria-label="Remove report.pdf" onClick={() => undefined}>
      <XIcon />
    </AttachmentAction>
  </AttachmentActions>
</Attachment>

Anatomy

Attachment
├── AttachmentMedia
├── AttachmentContent
│   ├── AttachmentTitle
│   └── AttachmentDescription
├── AttachmentActions
│   └── AttachmentAction
└── AttachmentTrigger

AttachmentGroup
└── Attachment…

States and variants

  • state: idle, uploading, processing, error, or done
  • size: default, sm, or xs
  • orientation: horizontal or vertical
  • AttachmentMedia variant: icon or image

uploading and processing shimmer the title. error changes the visual treatment, so include a readable failure reason in AttachmentDescription rather than relying on color alone.

Interaction patterns

Use AttachmentTrigger to make the card actionable while keeping AttachmentAction controls as separate sibling buttons. Label every icon-only action and overlay trigger.

<Attachment>
  {/* media, content, and actions */}
  <AttachmentTrigger render={<a aria-label="Open report.pdf" href={fileUrl} />}>
    Open report.pdf
  </AttachmentTrigger>
</Attachment>

For a scrollable AttachmentGroup, add tabIndex={0}, role="region", and an aria-label so keyboard users can reach and identify it. The component provides a visible focus ring, and the full scroll-fade utility family ships with the registry theme.

For agent-generated files, describe the artifact as generated, show a readable processing or failure state, and keep card navigation separate from actions such as copy or remove. File URLs remain application data: validate allowed protocols and hosts before passing a server-provided URL to href or an image source.

Credits

Recent changes

  • patchv1.2.0Pin shipped dependency floors to the version we develop against. Registry items now declare ranges like `^5.1.9` (the actual installed version) instead of collapsing to `^5.0.0`, so consumers start on the known-tested baseline while caret semantics still allow any compatible release within the same major.#133
  • minorv1.1.0Theme docs refresh, readability pass on semantic foregrounds, and consumer-facing Base UI regression fixes.#121
  • minorv1.0.0Post-Base-UI polish. Public API unchanged.#116
  • majorv1.0.0Migrate every Radix-based primitive to `@base-ui/react@^1.4.0` (Base UI).#114
  • minorv0.3.0Add theme-provider component to the registry with documentation and tests. Includes playground type improvements (export RegistryItem, remove as-const boilerplate) and docs site dark mode border color fix.#109
See full history →
Built by malinskibeniamin. The source code is available on GitHub.

On this page