GitHub

File List

A list of existing files (server records) rendered as bordered icon · name · actions rows — the read/manage counterpart to esa-file-upload. Ported from Beacon's simple-file-display.

Stable wc import '@esa/ecology/esa-file-list';

Preview

<esa-file-list id="files"></esa-file-list>

<script>
  el.files = [
    { name: 'nesting-bird-survey-2026.pdf', href: '#' },
    { name: 'weap-signin-2026-05.pdf', href: '#' },
  ];
</script>

Download & remove

Each row can carry a download action, a remove action, or both. The editor case uses removable with downloadable=false; a read-only display uses the default (download only).

<esa-file-list downloadable removable></esa-file-list>  <!-- both -->
<esa-file-list removable downloadable="false"></esa-file-list>  <!-- remove only -->

API

PropTypeDefaultDescription
files { name: string, href?: string }[] [] The files to list. Set as a property (an array, not an attribute). A row with an href renders its name as a link.
downloadable boolean true Show a download button on each row (emits download).
removable boolean false Show a remove button on each row; removing drops it from the local files copy and emits remove.

Events

EventTypeDefaultDescription
download CustomEvent<{ file, index }> Fired when a row’s download button is clicked. Composed and bubbles.
remove CustomEvent<{ file, index }> Fired when a row’s remove button is clicked. The row is removed from the local files copy first. Composed and bubbles.

Accessibility

  • Each action button carries an explicit aria-label naming the file (e.g. “Download nesting-bird-survey.pdf”).
  • File names truncate with ellipsis; the full name is available via the row title.
  • Removing a row updates the local files array and emits remove; consumers persist the change.

Theming surface

Every public token this component reads, extracted from its source at build time. The Resolves to column walks each token's real lineage — component → semantic → primitive → raw value — so you can see exactly where re-pointing it lands. A spoke re-skins by overriding these in its theme-<slug>.css; component internals are never edited. No hook for what you need? File it with /request-lego.

TokenTierResolves to
--color-link component #2a7e3b via --color-primary-strong--color-grass-11
--focus-ring-color component #65ba74 via --color-border-focus--color-grass-8
--focus-ring-width component 2px
--form-border-width component 1px
--file-list-row-padding-x ad-hoc 0.75rem via --spacing-300
--file-list-row-padding-y ad-hoc 2px
--color-border semantic #cecece via --color-gray-7
--color-danger semantic #e5484d via --color-red-9
--color-surface semantic #fcfcfc via --color-gray-1
--color-surface-sunken semantic #f0f0f0 via --color-gray-3
--color-text-muted semantic #838383 via --color-gray-10
--color-text-primary semantic #202020 via --color-gray-12
--font-sans semantic 'DM Sans', sans-serif
--transition-fast semantic 150ms ease
--type-size-150 semantic clamp(0.6875rem, 0.61rem + 0.38vw, 0.875rem)
--radius-100 primitive 0.25rem
--spacing-050 primitive 0.125rem
--spacing-150 primitive 0.375rem
--spacing-200 primitive 0.5rem