Attachment
A file attached to a message, with its name, type and size.
Left out of Brand expressive Brand expressive keeps only the parts in use for one action and a story, not a part for one campaign. Sharing files in a conversation is neither. Use instead: Card
See it live
npm run storybookWhen to use it
- Use it when: A conversation that shares files people may open or download.
- Not when: Uploading files in a form (a file input), or images meant to be seen inline.
Instead:
- Message: The message the file belongs to.
Words
- Headlines are short and bold. Three to six words.
- Verbs that move: Join, Try, Go.
- Playful in headlines, plain in errors.
- Use: Join, Drop, Go, Love. Avoid: Synergy, Leverage, Kindly.
The labels components use, from the voice tokens:
content.action.commit: Gocontent.action.cancel: Not nowcontent.action.destroy: Removecontent.action.retry: Try againcontent.action.empty-action: Explore the drop
See Voice and tone for the whole voice.
Accessibility and keyboard
Test before you ship:
- The link names the file and its type and size, not just Download. undefined
Use it in code
npx open-ds add attachment
The component reads only component keys and semantic tokens, so it follows the brand and mode on <html>.
Tokens it reads
Attachment reads 17 tokens of its own, each an alias of a semantic token. Each row is one part: its own token, the semantic it aliases, and the value it ends at. Change a semantic and every component that reads it follows; override one of Attachment's tokens to change Attachment alone.
Brand expressive decides what changes when you switch theme. Here a switch changes colors only, so the marked rows differ between light and dark; everything else holds steady.
| Part | Its token and the semantic it aliases | Value |
|---|---|---|
| Attachment | ||
| Gap | component.attachment.gapcomponent-spacing-map.x3var(--attachment-gap) | space.24:1.5rem |
| Corner | component.attachment.radiusradius.controlvar(--attachment-radius) | radius.999:9999px |
| Fill Changes with theme | component.attachment.backgroundcolor.surface.canvasvar(--attachment-background) | Lighttaupe.light.50:#FFF8F3Darktaupe.dark.0:#120B09 |
| Padding, left and right | component.attachment.padding-xcomponent-spacing-map.x3var(--attachment-padding-x) | space.24:1.5rem |
| Padding, top and bottom | component.attachment.padding-ycomponent-spacing-map.x2var(--attachment-padding-y) | space.8:0.5rem |
| Text size | component.attachment.font-sizetype.body.font-sizevar(--attachment-font-size) | font.size.17:1.0625rem |
| Background hover Changes with theme on hover | component.attachment.background-hovercolor.surface.sunkenvar(--attachment-background-hover) | Lighttaupe.light.100:#FCEFE6Darktaupe.dark.100:#33241F |
| Focus on focus | component.attachment.focusborder-width.focusvar(--attachment-focus) | border-width.3:3px |
| Focus ring focus Changes with theme on focus | component.attachment.focus-ring-focuscolor.border.focusvar(--attachment-focus-ring-focus) | Lightpink.light.600:#D61F7ADarkpink.dark.600:#F59ACA |
| Focus ring offset focus Changes with theme on focus | component.attachment.focus-ring-offset-focuscolor.surface.canvasvar(--attachment-focus-ring-offset-focus) | Lighttaupe.light.50:#FFF8F3Darktaupe.dark.0:#120B09 |
| Size | component.attachment.sizesize.control.defaultvar(--attachment-size) | size.52:3.25rem |
| Radius 2 | component.attachment.radius-2radius.badgevar(--attachment-radius-2) | radius.999:9999px |
| Background 2 Changes with theme | component.attachment.background-2color.surface.sunkenvar(--attachment-background-2) | Lighttaupe.light.100:#FCEFE6Darktaupe.dark.100:#33241F |
| Icon size | component.attachment.icon-sizesize.iconvar(--attachment-icon-size) | size.20:1.25rem |
| Text Changes with theme | component.attachment.labelcolor.text.mutedvar(--attachment-label) | Lighttaupe.light.600:#6B544ADarktaupe.dark.400:#B5988A |
| Weight | component.attachment.font-weighttype.label.font-weightvar(--attachment-font-weight) | font.weight.700:700 |
| Font size 2 | component.attachment.font-size-2type.caption.font-sizevar(--attachment-font-size-2) | font.size.14:0.875rem |
| From the system | ||
| Edge Changes with theme | color.border.default straight from the system, through --border | Lighttaupe.light.200 · #F2DCCFDarktaupe.dark.100 · #33241F |