Faber UI
Components

Attachment

A file or attachment card with upload state and actions.

Attachment is a composable card for displaying files and uploads. It supports upload states, sizes, and orientations, with optional media and action slots.

Installation

Terminal
pnpm dlx shadcn@latest add https://faber-ui.vercel.app/r/attachment.json

Usage

typescript
import {
  Attachment,
  AttachmentAction,
  AttachmentActions,
  AttachmentContent,
  AttachmentDescription,
  AttachmentMedia,
  AttachmentTitle,
} from "@/components/ui/attachment";
import { RiDownloadLine, RiFileTextLine } from "@remixicon/react";

export default function Example() {
  return (
    <Attachment>
      <AttachmentMedia variant="icon">
        <RiFileTextLine />
      </AttachmentMedia>
      <AttachmentContent>
        <AttachmentTitle>report.pdf</AttachmentTitle>
        <AttachmentDescription>1.2 MB</AttachmentDescription>
      </AttachmentContent>
      <AttachmentActions>
        <AttachmentAction render={<button />}>
          <RiDownloadLine />
        </AttachmentAction>
      </AttachmentActions>
    </Attachment>
  );
}

Examples

Default

report.pdf1.2 MB

Upload states

idle-file.pdfWaiting to upload
uploading.pdfUploading, 45%
failed.pdfUpload failed

Sizes

default.pdf1.2 MB
small.pdf1.2 MB
extra-small.pdf1.2 MB

Group

file-1.pdf1.2 MB
file-2.pdf3.4 MB

API

Each part forwards every prop of what it is built on, including className and render where Base UI supports it. The props column lists only what Faber UI adds on top.

PartBuilt onProps
Attachmentdata-slot="attachment"<div>HTML
  • size? = "default""default" | "sm" | "xs"
  • orientation? = "horizontal""horizontal" | "vertical"
  • state? = "done""idle" | "uploading" | "processing" | "error" | "done"
AttachmentMediadata-slot="attachment-media"<div>HTML
  • variant? = "icon""icon" | "image"
AttachmentContentdata-slot="attachment-content"<div>HTML—
AttachmentTitledata-slot="attachment-title"<span>HTML—
AttachmentDescriptiondata-slot="attachment-description"<span>HTML—
AttachmentActionsdata-slot="attachment-actions"<div>HTML—
AttachmentActiondata-slot="attachment-action"ButtonFaber UI—
AttachmentTriggerdata-slot="attachment-trigger"<button>HTML—
AttachmentGroupdata-slot="attachment-group"<div>HTML—

Last updated on

On this page