Hatch

Hatch's shadcn registry

On this page

Hatch's board, chat, search, editor and grid as shadcn components: the code lands in your project, you own it, and it reads and writes a Hatch vault (plain Markdown notes that agents, sync and Obsidian share).

pnpm dlx shadcn add @hatchmd/board @hatchmd/chat @hatchmd/editor @hatchmd/grid @hatchmd/search
npx shadcn add @hatchmd/board @hatchmd/chat @hatchmd/editor @hatchmd/grid @hatchmd/search
yarn dlx shadcn add @hatchmd/board @hatchmd/chat @hatchmd/editor @hatchmd/grid @hatchmd/search
bunx --bun shadcn add @hatchmd/board @hatchmd/chat @hatchmd/editor @hatchmd/grid @hatchmd/search

The grid needs @hatchmd/app, which isn't on npm (the app is built with Vite). Inside this repo it works as is (apps/shadcn-demo). The other items install from npm.

Set up

Tell shadcn where the @hatchmd items are, in components.json:

{
  "registries": {
    "@hatchmd": "https://<your Hatch host>/r/{name}.json"
  }
}

Every Hatch web build serves the registry at /r/ (apps/web/public/r).

Then put the vault around the part of your app that uses it:

import { HatchVault } from '@/components/hatch/hatch-vault'
import { Board } from '@/components/hatch/board'

<HatchVault me="Alex">
  <Board project="Website" />
</HatchVault>

HatchVault keeps the vault in the browser's own storage, apart from Hatch's own web app vault, and starts it with a small team workspace. vaultKey keeps two apps on one site apart. To open a folder, a server vault or anything else, use HatchProvider from @hatchmd/react with your own Vault (see react.md).

The items

ItemWhat you getBuilt on
@hatchmd/hatch-vaultHatchVault: a vault in the browser, with Hatch's hooks in reach. The others need it@hatchmd/react
@hatchmd/board<Board project="Website" />: columns by status, drag to move, add at the foot of a column. Moves show in other tabs at onceuseBoard
@hatchmd/chat<Chat channel="general" />: messages, who's typing, older daysuseChannel
@hatchmd/search<VaultSearch onPick={(path) => ...} />: tasks by id, status, assignee or label, then full textuseVaultSearch
@hatchmd/editor<Editor value={md} onChange={setMd} />: Hatch's Markdown editor, unchanged blocks byte for byte@hatchmd/editor/react
@hatchmd/grid<Grid csv={text} onChange={save} />: a million-row CSV opens as fast as ten rows; select, copy, paste, edit, sort, filter@hatchmd/app/grid

Each item also gives the AI built into the browser its own tools while it's on screen (WebMCP): board_read, board_add_card and board_move_card, chat_read and chat_post, search_vault and open_result, editor_read and editor_edit. The agent calls them instead of reading the page and clicking. With two of one kind on a page, give each an agentName (<Board project="Website" agentName="website_board" />). See webmcp.md.

The board, chat and search use Tailwind classes and shadcn's tokens (bg-card, text-muted-foreground, ring-ring), so they take your theme. The editor and grid draw Hatch's own controls; shadcnTokens (in hatch-theme.ts, installed with them) points Hatch's color tokens at yours, dark mode included. Their styles name only Hatch's own classes, so the rest of your page is untouched.

Working on it

  • The components are in apps/registry/src/hatch, listed in apps/registry/registry.json.
  • After changing one, run pnpm --filter @hatch/registry build. It writes apps/web/public/r, and apps/registry/src/registry.test.ts fails while that's out of date.
  • apps/shadcn-demo is a shadcn app using all of them on one vault (pnpm --filter @hatch/shadcn-demo dev, port 5185; ?as=Sam in a second tab to be someone else). scripts/e2e-shadcn.py checks it. ?show=board,chat, ?rows=1000000, ?title= and ?about= trim it for recordings, and python3 scripts/demo-videos.py <folder> records the short demo videos (two people live on one board and chat, and a million-row grid) as MP4s. With --agent it also records a real model, through the AI SDK with the vault as memory, turning a standup into cards and a chat post (src/agent/server.ts, which also runs on its own with pnpm --filter @hatch/shadcn-demo agent-demo; it needs ANTHROPIC_API_KEY or AI_GATEWAY_API_KEY).