Skip to content

Attachment

Free

One file in your app as a chip, tile, row, card, or gallery photo. It shows upload progress and has Retry, Pause, and Undo.

  • Base UI
  • Motion
  • React 19
  • Tailwind CSS 4

Added Nov 16, 2026 · MIT + Commons Clause

Playground

Loading the preview

Props

Put an Attachment for each file in Attachments, and compose its parts as children.

message-files.tsx

Attachments

<ul>
PropTypeDefaultDescription
layout"card""chip""gallery""row""tile""chip"chip (default), tile, row, card, or gallery (photos sent together).
size"default""sm""default"default or sm (chip 32, tile 72, a compact row, card 200).
mode"compose""sent""compose"compose (default): a draft with Remove. sent: the files of a message; a press opens.
uploads—The upload queue (useFileUploads): Remove, Retry, Pause, and Undo act on it by entry id.
filesreadonly AttachmentFile[]—The saved files to show when there are no children (and no uploads).
onOpenAttachmentOpenHandler—Opens a file (the File Viewer seam): a press on a sent file, Open, or a gallery photo. With none, Open goes to the safe url in a new tab, else it downloads the file.
maxnumber—Shows this many files, then a +N button (AttachmentsOverflow).
filter"active""all""done""failed"—The filter of the files (AttachmentsFilters). Controlled.
defaultFilter"active""all""done""failed""all"
onFilterChange—
selectablebooleanfalseShows a checkbox on each file and the selection of AttachmentsBatchBar.
selectedreadonly string[]—The ids of the selected files. Controlled.
defaultSelectedreadonly string[]NO_IDS
onSelectedChange—
labels—The words (ATTACHMENT_LABELS). Keep the object stable.
localestring—The locale of sizes and times. Default: the DisplayLocaleProvider locale.
childrenReactNode—Attachment items (each with a stable key) and group parts. None: the default list.
...props<ul> attributes—Every other attribute goes to the <ul>, with a ref.

Attachment

<li>
PropTypeDefaultDescription
childrenReactNode—The parts of the file. None: the default anatomy of the layout and mode.
fileAttachmentFile—The file: a page File (a draft) or a saved file. Optional with an entry.
idstring—A stable id. Default: the entry id, the saved file id, or the name.
entry—The upload entry of useFileUploads: it sets the file, status, progress, error, and speed.
status"blocked""done""error""locked""paused""processing""queued""uploading"—Where the file is (wins over the entry status, so an app can set processing).
progressnumber | null—0 to 100 while uploading; null while not known.
errorstring—Why the file failed or was blocked.
detailstring—The meta words in your words ("Reading 3 of 12 pages", "Link expired on Nov 2").
onRemove—Removes the file when the app owns the list (no uploads, no Dropzone around it). It wins over the queue and the host list. Remove shows only when one of them can act.
onRetry—Sends a failed file again when the app owns the upload. It wins over the queue and the host.
...props<li> attributes—Every other attribute goes to the <li>, with a ref.

AttachmentPreview

<span>
PropTypeDefaultDescription
...props<span> attributes—Every other attribute goes to the <span>, with a ref.

AttachmentName

<span>
PropTypeDefaultDescription
...props<span> attributes—Every other attribute goes to the <span>, with a ref.

AttachmentMeta

<span>
PropTypeDefaultDescription
...props<span> attributes—Every other attribute goes to the <span>, with a ref.

AttachmentProgress

<div>
PropTypeDefaultDescription
...props<div> attributes—Every other attribute goes to the <div>, with a ref.

AttachmentActions

<span>
PropTypeDefaultDescription
...props<span> attributes—Every other attribute goes to the <span>, with a ref.

AttachmentRemove

<button>
PropTypeDefaultDescription
classNamestring—
busyboolean—The button waits for the app (busy words): a spinner, aria-busy, and no clicks. Focus stays on the button. The style hook stays data-loading.
spinnerPlacement"center""start"—center (default): the spinner covers the label. start: it takes the leading icon slot. The icon sizes always use center, because their one icon is the label.
glass"clear""dark""light"—
childrenReactNode—The icon. Default: an X (a trash can on a finished row).
From Base UIButtonBase UI docs
focusableWhenDisabledbooleanfalseWhether the button should be focusable when disabled.
render—Allows you to replace the component's HTML element with a different tag, or compose it with another component. Accepts a ReactElement or a function that returns the element to render.
style—Style applied to the element, or a function that returns a style object based on the component's state.
...props<button> attributes—Every other attribute goes to the <button>, with a ref.

AttachmentRetry

<button>
PropTypeDefaultDescription
classNamestring—
busyboolean—The button waits for the app (busy words): a spinner, aria-busy, and no clicks. Focus stays on the button. The style hook stays data-loading.
spinnerPlacement"center""start"—center (default): the spinner covers the label. start: it takes the leading icon slot. The icon sizes always use center, because their one icon is the label.
glass"clear""dark""light"—
childrenReactNode—The word on a row, the icon elsewhere. Default: "Retry", a turn arrow.
From Base UIButtonBase UI docs
focusableWhenDisabledbooleanfalseWhether the button should be focusable when disabled.
render—Allows you to replace the component's HTML element with a different tag, or compose it with another component. Accepts a ReactElement or a function that returns the element to render.
style—Style applied to the element, or a function that returns a style object based on the component's state.
...props<button> attributes—Every other attribute goes to the <button>, with a ref.

AttachmentPause

<button>
PropTypeDefaultDescription
classNamestring—
busyboolean—The button waits for the app (busy words): a spinner, aria-busy, and no clicks. Focus stays on the button. The style hook stays data-loading.
spinnerPlacement"center""start"—center (default): the spinner covers the label. start: it takes the leading icon slot. The icon sizes always use center, because their one icon is the label.
glass"clear""dark""light"—
From Base UIButtonBase UI docs
focusableWhenDisabledbooleanfalseWhether the button should be focusable when disabled.
render—Allows you to replace the component's HTML element with a different tag, or compose it with another component. Accepts a ReactElement or a function that returns the element to render.
style—Style applied to the element, or a function that returns a style object based on the component's state.
...props<button> attributes—Every other attribute goes to the <button>, with a ref.

AttachmentDownload

<button>
PropTypeDefaultDescription
classNamestring—
busyboolean—The button waits for the app (busy words): a spinner, aria-busy, and no clicks. Focus stays on the button. The style hook stays data-loading.
spinnerPlacement"center""start"—center (default): the spinner covers the label. start: it takes the leading icon slot. The icon sizes always use center, because their one icon is the label.
glass"clear""dark""light"—
From Base UIButtonBase UI docs
focusableWhenDisabledbooleanfalseWhether the button should be focusable when disabled.
render—Allows you to replace the component's HTML element with a different tag, or compose it with another component. Accepts a ReactElement or a function that returns the element to render.
style—Style applied to the element, or a function that returns a style object based on the component's state.
...props<button> attributes—Every other attribute goes to the <button>, with a ref.

AttachmentOpen

<button>
PropTypeDefaultDescription
From Base UIButtonBase UI docs
focusableWhenDisabledbooleanfalseWhether the button should be focusable when disabled.
className—CSS class applied to the element, or a function that returns a class based on the component's state.
style—Style applied to the element, or a function that returns a style object based on the component's state.
...props<button> attributes—Every other attribute goes to the <button>, with a ref.

AttachmentMenu

<button>
PropTypeDefaultDescription
classNamestring—
busyboolean—The button waits for the app (busy words): a spinner, aria-busy, and no clicks. Focus stays on the button. The style hook stays data-loading.
spinnerPlacement"center""start"—center (default): the spinner covers the label. start: it takes the leading icon slot. The icon sizes always use center, because their one icon is the label.
glass"clear""dark""light"—
childrenReactNode—The menu items. None: Open, Download, Copy link, and Delete (on a draft).
From Base UIButtonBase UI docs
focusableWhenDisabledbooleanfalseWhether the button should be focusable when disabled.
render—Allows you to replace the component's HTML element with a different tag, or compose it with another component. Accepts a ReactElement or a function that returns the element to render.
style—Style applied to the element, or a function that returns a style object based on the component's state.
...props<button> attributes—Every other attribute goes to the <button>, with a ref.

AttachmentSelect

<span>
PropTypeDefaultDescription
classNamestring—
size"default""lg"—default 16px, or lg 20px. Default: the CheckboxGroup size, else default.
From Base UICheckbox.RootBase UI docs
idstring—The id of the input element.
namestringundefinedIdentifies the field when a form is submitted.
formstring—Identifies the form that owns the hidden input. Useful when the checkbox is rendered outside the form.
...props<span> attributes—Every other attribute goes to the <span>, with a ref.

AttachmentsHeader

<li>
PropTypeDefaultDescription
...props<li> attributes—Every other attribute goes to the <li>, with a ref.

AttachmentsDownloadAll

<button>
PropTypeDefaultDescription
classNamestring—
busyboolean—The button waits for the app (busy words): a spinner, aria-busy, and no clicks. Focus stays on the button. The style hook stays data-loading.
spinnerPlacement"center""start"—center (default): the spinner covers the label. start: it takes the leading icon slot. The icon sizes always use center, because their one icon is the label.
glass"clear""dark""light"—
rounded"default""full"—
childrenReactNode—
From Base UIButtonBase UI docs
focusableWhenDisabledbooleanfalseWhether the button should be focusable when disabled.
render—Allows you to replace the component's HTML element with a different tag, or compose it with another component. Accepts a ReactElement or a function that returns the element to render.
style—Style applied to the element, or a function that returns a style object based on the component's state.
...props<button> attributes—Every other attribute goes to the <button>, with a ref.

AttachmentsSummary

<div>
PropTypeDefaultDescription
uploads—The queue, when the summary sits outside Attachments (the Uploads Panel head).
labels—
...props<div> attributes—Every other attribute goes to the <div>.

AttachmentsFilters

<div>
PropTypeDefaultDescription
uploads—The queue, when the filters sit outside Attachments.
filter"active""all""done""failed"—The filter, when the filters sit outside Attachments. Controlled.
defaultFilter"active""all""done""failed""all"The first filter outside Attachments. Default all.
onFilterChange—
labels—
...props<div> attributes—Every other attribute goes to the <div>.

AttachmentsOverflow

<button>
PropTypeDefaultDescription
classNamestring—
busyboolean—The button waits for the app (busy words): a spinner, aria-busy, and no clicks. Focus stays on the button. The style hook stays data-loading.
spinnerPlacement"center""start"—center (default): the spinner covers the label. start: it takes the leading icon slot. The icon sizes always use center, because their one icon is the label.
glass"clear""dark""light"—
rounded"default""full"—
childrenReactNode—
From Base UIButtonBase UI docs
focusableWhenDisabledbooleanfalseWhether the button should be focusable when disabled.
render—Allows you to replace the component's HTML element with a different tag, or compose it with another component. Accepts a ReactElement or a function that returns the element to render.
style—Style applied to the element, or a function that returns a style object based on the component's state.
...props<button> attributes—Every other attribute goes to the <button>, with a ref.

AttachmentsRemoved

PropTypeDefaultDescription
classNamestring—

AttachmentsBatchBar

<li>
PropTypeDefaultDescription
...props<li> attributes—Every other attribute goes to the <li>, with a ref.
  • Use it for the files of a composer, a message, an email, a task, or a form.
  • Pass uploads from useFileUploads to show progress, Pause, Retry, and Undo.
  • Set mode="sent" for files that were sent: a press opens the file.
  • Pass onOpen to open a file in your own viewer.
  • To only show the icon of a file type, use File Icon.
  • To let a person drop or pick files, use Dropzone.
TabMoves through the open layer and the actions of each file.
EnterorSpaceOpens a sent file, or runs the focused action (Remove, Retry, Pause, Download).
DeleteorBackspaceRemoves a draft file from a control on it. The focus moves to the next file.
Enter
panel · a new file fades in from 96% scale
Exit
fade · a removed file fades out and leaves the flow at once
Reflow
chart · the files after a removed one glide to their new place
Scan
sine · a line moves down the preview while the server reads the file, 1.6 s a pass
Actions
fade · the actions of a sent card show on hover and focus
  1. AddedAttachment, with Button, Checkbox, Circular Progress, File Icon, File Size, Image, Menu, Progress, Tabs.
Open the release