# Collections (Obsidian Bases)

In the app they're called collections. On disk they're Obsidian Bases (`.base` files), so both apps open them. In code they're still "bases".

![A collection of projects as a table, sorted by due date](https://hatch-docs.pages.dev/assets/collection-table-light.bc410f43ce.webp)
![A collection of projects as a table, sorted by due date](https://hatch-docs.pages.dev/assets/collection-table-dark.17e7a44a95.webp)

Hatch opens them as tables, cards, lists, boards, calendars and charts. Boards, calendars and charts are Hatch additions that Obsidian doesn't know about. A collection shows the notes that match its filters, with chosen properties as columns.

![The same collection as a board, grouped by status](https://hatch-docs.pages.dev/assets/collection-board-light.c32e34a945.webp)
![The same collection as a board, grouped by status](https://hatch-docs.pages.dev/assets/collection-board-dark.53dc9c4f62.webp)

## What works

- Filters for the whole base and for each view, nested with `and`, `or` and `not`.
- Formulas, property display names and column summaries.
- Table, cards and list views. Sorting, grouping and a row limit.
- Editing a note's property from its cell. The note changes, the base doesn't.
- Dates and durations: `due < today() + "1w"`, `(now() - file.ctime).days`.
- Editing the base as YAML, which is also how you fix a file Hatch can't read.

## Rules

- The parsed YAML is the source of truth. Settings Hatch doesn't know are written back unchanged. Comments are lost when Hatch saves a change, as in Obsidian.
- A file that isn't valid YAML is never saved over. It opens in the YAML editor with the reason.
- A filter that doesn't parse shows no rows and says why.
- Expressions have a work budget and size caps, so a formula can't freeze the app.

## Not yet

- The map view.
- Bases embedded in notes with a ```` ```base ```` block.
- Property types from `.obsidian/types.json`. Dates written as text (`2026-05-01`) count as dates next to other dates and durations.

## New notes

- **New** makes a note that shows up in the view: in the folder from `file.inFolder()`, with the values from simple `property == value` filters.
- On a board, each column has its own **New**, which also sets that column's value.
- On a calendar, each day has a **+** that makes a note with that date.

## Calendars

- A calendar view places each note on the day in a date property. It's saved as a `date` key on the view (`date: note.due`). Without one it uses the property that holds dates most often.
- Drag a note to another day, or focus it and press Alt with an arrow key (a day, or a week up and down). A time of day stays as it was.
- Notes without a date are listed under the month, and can be dragged onto a day.
- On a phone the month reads as a list of the days that have notes.
- Dates are written bare (`due: 2026-12-05`), so Obsidian reads them as dates too.
- A view can start new notes from a template. Pick it in Edit view, under "New notes start from". It's saved as a `template` key on the view. Obsidian keeps the key and ignores it.

## Inside a note

- Write a ```` ```base ```` block in any note, the same way Obsidian does, or type `/collection`.
- The block shows the collection. Its views switch, its table sorts, and **New** works, just like a `.base` file.
- Sorting there is just for looking: it never rewrites the block. Use Edit YAML (the pencil) to change it for good.
- `this` is the note the block is in, so `file.folder == this.file.folder` lists the notes next to it.
- On a published site the block becomes a table of its first view. Only published notes are listed.
- `![[Books.base]]` shows a collection file in a note. `![[Books.base#View]]` opens on that view. It's read-only there: open the collection to change it. Sites don't draw these yet.
