Attachment

Displays file and image attachments with media, metadata, upload state, and actions.

Workspace
workspace.pngPNG · 820 KB
Desk
desk-reference.jpgJPG · 1.1 MB
Office
office-reference.jpgJPG · 940 KB
sales-dashboard.pdfUploading · 64%
message-renderer.tsxTypeScript · 12 KB

Installation

ng g @spartan-ng/cli:ui attachment

Usage

import { HlmAttachmentImports } from '@spartan-ng/helm/attachment';
<div hlmAttachment>
  <div hlmAttachmentMedia>
    <ng-icon name="lucideFileCode" />
  </div>
  <div hlmAttachmentContent>
    <span hlmAttachmentTitle>report.pdf</span>
    <span hlmAttachmentDescription>PDF · 1.2 MB</span>
  </div>
</div>

Compose attachments inside a message bubble or as a standalone file card.

Examples

Image

Workspace
workspace.pngPNG · 820 KB
Desk
desk-reference.jpgJPG · 1.1 MB
Office
office-reference.jpgJPG · 940 KB

States

selected-file.pdfReady to upload
design-system.zipUploading · 64%
market-research.pdfProcessing document
financial-model.xlsxUpload failed. Try again.
uploaded-report.pdfUploaded · 1.8 MB

Sizes

Default attachmentPDF · 2.4 MB
Small attachmentPDF · 2.4 MB
Extra small attachment

Group

briefing-notes.pdfPDF · 1.4 MB
workspace.png
workspace.pngPNG · 820 KB
customers.csvCSV · 18 KB
renderer.tsxTSX · 12 KB

Trigger

Use hlmAttachmentTrigger to make the whole card open a dialog or link while keeping actions independently clickable.

research-summary.pdfOpen preview dialog

RTL

To enable RTL support in spartan-ng, see the RTL configuration guide.

message-renderer.tsxTypeScript · 12 كيلوبايت
مساحة العمل
workspace.pngPNG · 820 كيلوبايت

Helm API

HlmAttachmentAction

Selector: button[hlmAttachmentAction]

Inputs

PropTypeDefaultDescription
type 'button' | 'submit' | 'reset' 'button' -
variant ButtonVariants['variant'] this._config.variant -
size ButtonVariants['size'] this._config.size -

HlmAttachmentActions

Selector: [hlmAttachmentActions],hlm-attachment-actions

HlmAttachmentContent

Selector: [hlmAttachmentContent],hlm-attachment-content

HlmAttachmentDescription

Selector: [hlmAttachmentDescription],hlm-attachment-description

HlmAttachmentGroup

Selector: [hlmAttachmentGroup],hlm-attachment-group

HlmAttachmentMedia

Selector: [hlmAttachmentMedia],hlm-attachment-media

Inputs

PropTypeDefaultDescription
variant AttachmentMediaVariants['variant'] 'icon' -

HlmAttachmentTitle

Selector: [hlmAttachmentTitle],hlm-attachment-title

HlmAttachmentTrigger

Selector: button[hlmAttachmentTrigger],a[hlmAttachmentTrigger]

Inputs

PropTypeDefaultDescription
type 'button' | 'submit' | 'reset' | null 'button' -

HlmAttachment

Selector: [hlmAttachment],hlm-attachment

Inputs

PropTypeDefaultDescription
state AttachmentState 'done' -
size AttachmentVariants['size'] 'default' -
orientation AttachmentVariants['orientation'] 'horizontal' -
Autocomplete Aspect Ratio