The Collection component is a wrapper around the collectionStore. It renders the collection data and handles the loading state.


  • ref - A Firestore collection reference, query reference, or path string (e.g. posts)
  • startWith - (optional) initial value to use before the collection is fetched


  • default - The collection data
  • loading - Loading state

Slot Props

  • data - An array of document data
  • ref - The Firestore collection reference
  • firestore - The Firestore instance
  • count - The number of documents returned by the query


    import { Collection } from 'sveltefire';

<Collection ref={'posts'} let:data let:count>

    <p>Found {count} posts</p>
    {#each data as post}

    <p slot="loading">Loading...</p>