Composite

CollectionList

Collection entries as a grid or a list, each rendered by its preset’s card.

Grid

On a list page, renderList returns entries and page. Each entry carries its preset, which picks the card. See the blog demo.

  • A hand writing notes with a pen in a notebook on a wooden desk

    Oct 1, 2026 · 1 min read

    Why this library ships Markdown collections.

    • announcement
  • An open dictionary showing the entry for Esperanto

    Oct 15, 2026 · 2 min read

    Translations live in a folder per language and link by filename.

    • i18n
grid
---
import CollectionList from '@alfadormx/blocks/composite/CollectionList.astro';
import type { CollectionListEntry } from '@alfadormx/blocks/types/collectionlist';

const entries: CollectionListEntry[] = [
  {
    preset: 'post',
    headline: { title: 'Hello, world' },
    href: '/demos/saas/blog/hello-world',
    description: 'Why this library ships Markdown collections.',
    date: new Date('2026-10-01T12:00:00Z'),
    readingTime: 1,
    tags: ['announcement'],
    image: {
      src: '~/assets/images/content/writing-notebook.jpg',
      alt: 'A hand writing notes with a pen in a notebook on a wooden desk',
    },
  },
  {
    preset: 'post',
    headline: { title: 'Writing in two languages' },
    href: '/demos/saas/blog/second-post',
    description: 'Translations live in a folder per language and link by filename.',
    date: new Date('2026-10-15T12:00:00Z'),
    readingTime: 2,
    tags: ['i18n'],
    image: {
      src: '~/assets/images/content/dictionary-page.jpg',
      alt: 'An open dictionary showing the entry for Esperanto',
    },
  },
  {
    preset: 'post',
    headline: { title: 'An English-only post' },
    href: '/demos/saas/blog/third-post',
    description: 'This entry has no Spanish translation.',
    date: new Date('2026-11-01T12:00:00Z'),
    tags: ['i18n'],
  },
];
---

<CollectionList entries={entries} />

List

orientation: 'vertical' stacks the cards in one column.

  • A hand writing notes with a pen in a notebook on a wooden desk

    Oct 1, 2026 · 1 min read

    Why this library ships Markdown collections.

    • announcement
  • An open dictionary showing the entry for Esperanto

    Oct 15, 2026 · 2 min read

    Translations live in a folder per language and link by filename.

    • i18n
list
---
import CollectionList from '@alfadormx/blocks/composite/CollectionList.astro';
import type { CollectionListEntry } from '@alfadormx/blocks/types/collectionlist';

const entries: CollectionListEntry[] = [
  {
    preset: 'post',
    headline: { title: 'Hello, world' },
    href: '/demos/saas/blog/hello-world',
    description: 'Why this library ships Markdown collections.',
    date: new Date('2026-10-01T12:00:00Z'),
    readingTime: 1,
    tags: ['announcement'],
    image: {
      src: '~/assets/images/content/writing-notebook.jpg',
      alt: 'A hand writing notes with a pen in a notebook on a wooden desk',
    },
  },
  {
    preset: 'post',
    headline: { title: 'Writing in two languages' },
    href: '/demos/saas/blog/second-post',
    description: 'Translations live in a folder per language and link by filename.',
    date: new Date('2026-10-15T12:00:00Z'),
    readingTime: 2,
    tags: ['i18n'],
    image: {
      src: '~/assets/images/content/dictionary-page.jpg',
      alt: 'An open dictionary showing the entry for Esperanto',
    },
  },
];
---

<CollectionList entries={entries} orientation="vertical" gap="tight" />

Shared card config

defaultPostCardConfig is merged under every post card; an entry’s own values win.

  • A hand writing notes with a pen in a notebook on a wooden desk

    Oct 1, 2026 · 1 min read

    Why this library ships Markdown collections.

    • announcement
  • An open dictionary showing the entry for Esperanto

    Oct 15, 2026 · 2 min read

    Translations live in a folder per language and link by filename.

    • i18n
shared-config
---
import CollectionList from '@alfadormx/blocks/composite/CollectionList.astro';
import type { CollectionListEntry } from '@alfadormx/blocks/types/collectionlist';

const entries: CollectionListEntry[] = [
  {
    preset: 'post',
    headline: { title: 'Hello, world' },
    href: '/demos/saas/blog/hello-world',
    description: 'Why this library ships Markdown collections.',
    date: new Date('2026-10-01T12:00:00Z'),
    readingTime: 1,
    tags: ['announcement'],
    image: {
      src: '~/assets/images/content/writing-notebook.jpg',
      alt: 'A hand writing notes with a pen in a notebook on a wooden desk',
    },
  },
  {
    preset: 'post',
    headline: { title: 'Writing in two languages' },
    href: '/demos/saas/blog/second-post',
    description: 'Translations live in a folder per language and link by filename.',
    date: new Date('2026-10-15T12:00:00Z'),
    readingTime: 2,
    tags: ['i18n'],
    image: {
      src: '~/assets/images/content/dictionary-page.jpg',
      alt: 'An open dictionary showing the entry for Esperanto',
    },
  },
  {
    preset: 'post',
    headline: { title: 'An English-only post' },
    href: '/demos/saas/blog/third-post',
    description: 'This entry has no Spanish translation.',
    date: new Date('2026-11-01T12:00:00Z'),
    tags: ['i18n'],
  },
];
---

<CollectionList
  entries={entries}
  defaultPostCardConfig={{ readMoreLabel: 'Continue reading', readingTime: false }}
/>

Pager

The pager renders when page.lastPage is above 1. Page 1 lives at the route, later pages at <route>/page/<n>.

  • A hand writing notes with a pen in a notebook on a wooden desk

    Oct 1, 2026 · 1 min read

    Why this library ships Markdown collections.

    • announcement
  • An open dictionary showing the entry for Esperanto

    Oct 15, 2026 · 2 min read

    Translations live in a folder per language and link by filename.

    • i18n
pager
---
import CollectionList from '@alfadormx/blocks/composite/CollectionList.astro';
import type { CollectionListEntry } from '@alfadormx/blocks/types/collectionlist';

const entries: CollectionListEntry[] = [
  {
    preset: 'post',
    headline: { title: 'Hello, world' },
    href: '/demos/saas/blog/hello-world',
    description: 'Why this library ships Markdown collections.',
    date: new Date('2026-10-01T12:00:00Z'),
    readingTime: 1,
    tags: ['announcement'],
    image: {
      src: '~/assets/images/content/writing-notebook.jpg',
      alt: 'A hand writing notes with a pen in a notebook on a wooden desk',
    },
  },
  {
    preset: 'post',
    headline: { title: 'Writing in two languages' },
    href: '/demos/saas/blog/second-post',
    description: 'Translations live in a folder per language and link by filename.',
    date: new Date('2026-10-15T12:00:00Z'),
    readingTime: 2,
    tags: ['i18n'],
    image: {
      src: '~/assets/images/content/dictionary-page.jpg',
      alt: 'An open dictionary showing the entry for Esperanto',
    },
  },
];
---

<CollectionList
  entries={entries}
  page={{ currentPage: 2, lastPage: 3, url: { prev: '/demos/saas/blog', next: '#page-3' } }}
/>

Mixed presets

Each entry picks its own card, so one list can mix presets, for example on a home page that shows the latest post, case study and event.

  • A hand writing notes with a pen in a notebook on a wooden desk

    Oct 1, 2026 · 1 min read

    Why this library ships Markdown collections.

    • announcement
  • Mar 12, 2030, 6:00 PM–8:00 PM GMT+1

    New-season breads and pastries with coffee from three origins.

    Olmo Café & Bakery
mixed
---
import CollectionList from '@alfadormx/blocks/composite/CollectionList.astro';
import type { CollectionListEntry } from '@alfadormx/blocks/types/collectionlist';

const mixed: CollectionListEntry[] = [
  {
    preset: 'post',
    headline: { title: 'Hello, world' },
    href: '/demos/saas/blog/hello-world',
    description: 'Why this library ships Markdown collections.',
    date: new Date('2026-10-01T12:00:00Z'),
    readingTime: 1,
    tags: ['announcement'],
    image: {
      src: '~/assets/images/content/writing-notebook.jpg',
      alt: 'A hand writing notes with a pen in a notebook on a wooden desk',
    },
  },
  {
    preset: 'caseStudy',
    client: 'Example Jewellers',
    headline: { title: 'A ring configurator that sells' },
    href: '/demos/portfolio/work/ring-configurator',
    description: 'A 3D configurator with shareable codes for an online jeweller.',
    tags: ['3d'],
  },
  {
    preset: 'event',
    headline: { title: 'Autumn tasting evening' },
    href: '/demos/local/events/launch-meetup',
    description: 'New-season breads and pastries with coffee from three origins.',
    start: new Date('2030-03-12T17:00:00Z'),
    end: new Date('2030-03-12T19:00:00Z'),
    timezone: 'Europe/Madrid',
    location: { name: 'Olmo Café & Bakery' },
  },
];
---

<CollectionList entries={mixed} />

API Reference

PropTypeDefaultDescription
entriesCollectionListEntry[]—Entries in display order; each renders the card for its `preset`.
orientation'horizontal' | 'vertical''horizontal'`horizontal` lays cards in a grid; `vertical` stacks them in one column (default: 'horizontal').
columns1 | 2 | 3 | 43Grid columns at the widest size; ignored when vertical (default: 3).
gap'none' | 'tight' | 'normal' | 'loose''normal'Space between cards (default: 'normal').
classstring—Classes on the list (`data-collection-list`).
defaultPostCardConfigLayerConfig<Omit<PostCardProps, 'href' | 'date'>>—Layer merged under every PostCard, under each entry's own values.
defaultCaseStudyCardConfigLayerConfig<Omit<CaseStudyCardProps, 'href' | 'client'>>—Layer merged under every CaseStudyCard, under each entry's own values.
defaultEventCardConfigLayerConfig<Omit<EventCardProps, 'href' | 'start' | 'end' | 'past'>>—Layer merged under every EventCard, under each entry's own values.
pageCollectionListPage—Page position; the pager renders when there is more than one page.
prevButtonOmit<ButtonProps, 'href'> | false—Previous-page Button; `false` hides it (default: outline, per-language "Previous").
nextButtonOmit<ButtonProps, 'href'> | false—Next-page Button; `false` hides it (default: outline, per-language "Next").
pageStatusLabelstring—Pager status text; `{current}` and `{last}` are replaced (default: per-language "Page {current} of {last}").
pagerClassstring—Classes on the pager (`data-pager`).
langCodestring—Language of the pager's UI strings (default: the site's default language).