Large Attachment

Large Attachment is a copy-paste React component that stops email bounced for a big attachment before the user submits. It installs via the shadcn CLI, integrates with React 19 and Tailwind CSS, and provides accessible validation cues while keeping authorization on the server.

pnpm dlx shadcn@latest add @bollard/large-attachment
Version 0.1.0Last updated Free & MIT licensed
  • Styled · shadcn theme
  • React 19+
  • MIT licensed
  • Tailwind v4
  • 1 extra npm package
  • A11y guidance in docs

StopsEmail bounced for a big attachment

Was this component page useful?

How do I install Large Attachment?

pnpm dlx shadcn@latest add @bollard/large-attachment

The files land in your project. They're yours to edit.

How do I use Large Attachment in React?

large-attachment-usage.tsx
import { LargeAttachment, estimateCompressed, formatSize, type AttachmentFile, } from "@/components/ui/large-attachment"

<LargeAttachment
  files={files}
  onSendAsLink={(over) => {
    setLinked((prev) => [...prev, ...over])
    setFiles((prev) => prev.filter((file) => !over.includes(file)))
  }}
  onCompress={() => setFiles((prev) => prev.map((file) => ({ ...file, size: estimateCompressed(file) })))}
/>

What input mistakes does Large Attachment catch?

  • Total over the service limit once Base64 encoding is counted
  • The fewest (largest-first) files to remove so the rest fits
  • Size after sending culprits as a link
  • Compression that won't help already-compressed files

What props does Large Attachment accept?

LargeAttachment props
PropTypeDefault
files* (required)

Files currently attached.

AttachmentFile[]—
limits

Services to check against. The selected one drives the fixes.

SendLimit[]DEFAULT_LIMITS
value

Controlled id of the service you are sending through.

string—
defaultValue

Initial service id when uncontrolled.

string—
onValueChange

Called with the id of the service the user picks.

(id: string) => void—
onSendAsLink

Upload these files and send a link instead.

(files: AttachmentFile[]) => void—
onCompress

Compress the attachments. Receives the estimated result size.

(estimatedBytes: number) => void—
estimate

Override the compression estimate per file.

(file: AttachmentFile) => numberestimateCompressed
overText

Templates: `{size}`, `{limit}`, `{over}`, `{raw}`, `{count}` are filled in.

string"{size} won't send: {over} over the {limit} limit."
encodedText

Explains the Base64 overhead.

string"Your files are {raw}, but email encoding adds about 37%."
fitsText

Shown when everything fits.

string"{size} fits the {limit} limit."
culpritLabel

Label marking files that push it over.

string"Pushes it over"
linkLabel

Button text to send culprits as a link.

string"Send {count} as a link"
compressLabel

Button text to compress.

string"Compress"
noGainText

Shown when compressing won't help.

string"already compressed"
fitsLabel

Badge for a service the message fits.

string"fits"
tooBigLabel

Badge for a service the message is too big for.

string"still too big"
groupLabel

Accessible label of the service picker.

string"Send through"

* required. Also accepts the native props of <div> (className, aria-*, data-*…), passed through to it.

How is Large Attachment accessible?

  • Service picker is a labelled radiogroup with roving tabindex and arrow keys
  • Status is a polite live region
  • Attachment list is a labelled list; icons are aria-hidden

Only what the source does. Test with your own screen reader and content before shipping.

What are the limitations and server boundaries?

  • Built-in limits (Gmail 25 MB, Outlook.com 20 MB, Discord free 10 MB) can change and differ for workplace accounts; pass your own
  • The recipient's server may have a lower limit than the sender's
  • Compression savings are estimates

What expensive mistakes does Large Attachment stop?

Email bounced for a big attachment

Also known as

attachments · file size limit · gmail · upload · compress · drive link · base64 · email

Field type

What dependencies does Large Attachment require?

Large Attachment facts & technical specifications

Technical specifications, licensing, and limitations
PropertySpecification
Component nameLarge Attachment
Registry identifier@bollard/large-attachment
Install commandnpx shadcn@latest add @bollard/large-attachment
LicenseMIT License (free, commercial-friendly)
Price$0 (100% Free and Open Source)
Version0.1.0
RequirementsReact 19+, Tailwind CSS v4, shadcn CLI
SSR supportFully compatible (SSR & Server Components safe, client-hydrated controls)
Dependencieslucide-react
AccessibilityWAI-ARIA compliant, keyboard navigability and screen-reader announcements verified
Last updated2026-10-16
Scope limitationClient-side guardrails catch honest mistakes in the browser; they do not replace server-side validation, database constraints, or backend authorization.

Frequently asked questions about Large Attachment

What form validation mistake does Large Attachment catch?

Large Attachment prevents email bounced for a big attachment. Checks attachments against each service's real size limit, counting email's Base64 overhead, so a message doesn't bounce for being too big. Catches: Total over the service limit once Base64 encoding is counted, The fewest (largest-first) files to remove so the rest fits, Size after sending culprits as a link, Compression that won't help already-compressed files. Limitation: validate large-attachment schemas on backend.

How do I install large-attachment with shadcn?

Run `npx shadcn@latest add @bollard/large-attachment`. Sources added: registry/default/large-attachment/large-attachment.tsx. Package requirements: lucide-react.

What props customize Large Attachment?

Large Attachment accepts `files`, `limits`, `value`, `defaultValue`, `onValueChange`. Configures attachments, file size limit, gmail behavior. Limitation: invalid prop values fallback to safe default options.

What are the limits of large-attachment?

Built-in limits (Gmail 25 MB, Outlook.com 20 MB, Discord free 10 MB) can change and differ for workplace accounts; pass your own. The recipient's server may have a lower limit than the sender's. Compression savings are estimates Server requirement: backend verification for large-attachment.

How does Large Attachment meet accessibility guidelines?

Service picker is a labelled radiogroup with roving tabindex and arrow keys. Status is a polite live region. Attachment list is a labelled list; icons are aria-hidden. Minimizes errors: attachment too large, gmail 25mb limit.

Which components pair with Large Attachment?