Attachment
One file as a chip — a plate, its name, and the actions on it — for files a surface is collecting or already holds.
Attachment
One file, as a chip: a plate for what it is, a name, a line of metadata under it, and the one action that applies. Nothing here uploads anything — the caller owns the transfer and moves the chip through the states as it resolves.
Usage
import {
Attachment,
AttachmentAction,
AttachmentActions,
AttachmentContent,
AttachmentDescription,
AttachmentGroup,
AttachmentMedia,
AttachmentTitle,
AttachmentTrigger,
} from '@oceanic-hub/brand-system'<Attachment>
<AttachmentMedia>…</AttachmentMedia>
<AttachmentContent>
<AttachmentTitle>…</AttachmentTitle>
<AttachmentDescription>…</AttachmentDescription>
</AttachmentContent>
<AttachmentActions>
<AttachmentAction>…</AttachmentAction>
</AttachmentActions>
</Attachment>Composition
Use the following composition to build an Attachment:
Attachment
├── AttachmentMedia
├── AttachmentContent
│ ├── AttachmentTitle
│ └── AttachmentDescription
├── AttachmentActions
│ └── AttachmentAction
└── AttachmentTrigger
AttachmentGroup
└── Attachment
├── AttachmentMedia
└── AttachmentContent
└── AttachmentTitleReach for it wherever a file is a thing a reader can still act on: the tray under a
composer, the evidence attached to a record, the queue behind a drop zone. It is a chip, so a
row of them reads as a set. If the files need columns a reader sorts and compares — size, owner,
uploaded-at — that is Table; if what you are listing is a record that happens to have a file
on it, that is Item.
state is DISPLAY, not machinery. Nothing here uploads anything: the caller owns the request
and moves the chip through the states as it resolves. That is also why there is no progress bar
part — a percentage lives in the caller's state, and a component that owned one would need to own
the transfer too. Compose Progress under the chip, or put a Spinner in the plate, which is
what the in-flight states expect.
idle is the odd one and the useful one: it dashes the border, so an empty chip is the drop
target itself rather than a file that failed. Pair it with the surface's own drag handlers.
Five things upstream shows that this package refuses, each already argued in
pairings.json and in the component's contract. The title never shimmers while a file
uploads — an animation that is the only carrier of a state disappears under reduced motion, so
the mark is state plus a spinner you supply. The group does not fade at its edges — a
gradient mask is a decoration, and ScrollArea set that precedent first. The focus ring is
not a translucent glow; focus moves the border to brand, the same as a select trigger.
And the description keeps its ink in every state, error included: a status tone here is the
border and the plate, never the sentence. And the row's action button does not shrink below
the touch floor — upstream's icon-xs is 24px, under the 32px floor @OCE-1755 pinned on
Button; the action takes icon-sm.
The whole-card click target is asChild, not upstream's render — this package is Radix,
and asChild is the idiom every other slotting component here already uses. One caution when
you wrap a part of your own: the internal data-slot attributes are load-bearing in this
component, uniquely. The padding and layout rules select on them, so a wrapper that drops them
builds green and lays out wrong.
States
One ramp the caller does not choose — the transfer moves the chip through uploading, processing and done as it resolves. The two you set yourself are the ends: idle on the drop target, where the dashed border says "put one here" rather than "this one failed", and error, which tints the plate and the boundary and leaves the sentence in ordinary ink, because a status tone is a fill and never text. Supply your own Spinner while a transfer is in flight — the mark has to survive reduced motion.
Image
Reach for the image plate when the file IS the picture. It is a thumbnail well: it crops whatever img you drop in to a square, and its ground is theme-invariant on purpose, so a transparent PNG sits on one colour in both themes instead of vanishing into whichever one matches it. The wells below are shown empty — that is the plate itself, which is what the variant styles.
Vertical
Stack the plate above the name when the file is browsed rather than listed — a gallery of renders, a strip of screenshots — and the picture is what a reader scans for. The chip takes a fixed narrow width so a row of them lines up, and the actions lift into the top corner of the plate instead of sitting after the name.
Sizes
Three densities for three places: the default chip under a composer, sm in a sidebar or a list of many, xs inside a card where the file is a detail of something else. This is card density, not touch: the action button holds its 32px floor at every size, so a smaller chip never shrinks the only thing a finger has to hit.
A scrolling group
Reach for AttachmentGroup when the set is longer than the space it has: the chips keep their width and the row scrolls, snapping each one to the left edge, rather than wrapping into a block that pushes the rest of the composer down. Upstream masks the overflow with a gradient fade; that is refused here — a gradient mask is a decoration, and ScrollArea already set the precedent of no fade-out edges.
A clickable card
AttachmentTrigger covers the whole chip, so the card opens a preview wherever a reader clicks it, while the remove button keeps its own smaller target on top. Reach for it instead of wrapping the chip in a link: the trigger is asChild, so the host supplies the anchor or the dialog trigger and the chip stays a chip.
API Reference
See the Attachment API page for every prop of every part, with types, defaults and the contract that pins them. It also documents attachmentMediaVariants and attachmentVariants — exported alongside the parts, and signatures rather than props.