Data display

Attachment

A static file card with an icon, a name, details and optional actions, in upload states your application sets.

Class nameTypeDescription
attachmentplf:attachmentComponentA file card
attachment-groupplf:attachment-groupComponentA list of attachments
attachment-mediaplf:attachment-mediaPartThe icon box
attachment-iconplf:attachment-iconPartAn SVG icon; an icon class there doesn't need it
attachment-contentplf:attachment-contentPartThe title and description
attachment-titleplf:attachment-titlePartThe file name
attachment-descriptionplf:attachment-descriptionPartDetails such as size and status
attachment-actionsplf:attachment-actionsPartLinks or buttons after the content
attachment-smplf:attachment-smSizeSmall

Default

Attachment uploads nothing; File Upload builds the same cards from the files a person selects.

report.pdf

240 KB

States

data-plf-state="idle" dashes the border and "error" colors it; write the state in the description too, and add aria-busy="true" while work is pending.

  • notes.txt

    12 KB · Waiting

  • photos.zip

    4.2 MB · Uploading

    45%
  • report.pdf

    240 KB · Uploaded

  • invoice.pdf

    Upload failed

report.pdf

240 KB

Download

report.pdf

240 KB

report.pdf

240 KB

React

Attachment from @pelatform/react renders this card from its props, and each part is a component of its own.

Prop Values Default
size sm The default size
state idle or error, written as data-plf-state None
Part Element
AttachmentMedia A span with attachment-media, around an Icon or your SVG with attachment-icon
AttachmentContent A div with attachment-content
AttachmentTitle A p with attachment-title
AttachmentDescription A p with attachment-description
AttachmentActions A div with attachment-actions
AttachmentGroup A ul with attachment-group and role="list", whose attachments are li elements with the attachment class, as in States

The other props are the element’s own, className and ref included.

CSS variables

Override on a root or on a single attachment.

Variable Default
--plf-attachment-gap Space 3 (12px)
--plf-attachment-padding Space 3 (12px); space 2 (8px) with attachment-sm
--plf-attachment-radius Large radius (8px)
--plf-attachment-bg Transparent
--plf-attachment-color Text
--plf-attachment-border --plf-color-border-subtle, or --plf-color-danger in the error state; also the icon box’s border
--plf-attachment-description-color Muted text
--plf-attachment-media-size 2.5rem (40px)
--plf-attachment-icon-size 1.25rem (20px)

Built with Pelatform UIv0.1.0

Components

Getting started

Foundations

Components

Actions

Data display

Navigation

Feedback

Data input

Layout

Advanced

Integrations

Blocks

Application

Authentication

Icons