TBX Docs
General structure

General structure

How a TBX textbook is organized

All book content lives in src/book:

src/book/
├── _img/              # Page images (used for hotspots)
├── 00_Cover/          # Chapter (alphabetical order by default)
│   ├── toc.ts         # Chapter metadata
│   ├── 001/
│   │   ├── page.tsx   # Page component (required)
│   │   ├── toc.ts     # Page TOC metadata
│   │   └── atoms.tsx   # Hotspot content / atoms (optional)
│   └── 002/
└── 01_Chapter/
    ├── toc.ts
    ├── 020/
    │   ├── page.tsx
    │   ├── toc.ts
    │   └── atoms.tsx
    └── 021/

Chapters

Each top-level subfolder under src/book is a chapter (e.g. 00_Cover, 01_Chapter). Chapters appear in alphabetical order by folder name unless overridden in toc.ts. Use numeric prefixes (00_, 01_) to control order.

Pages

Each subfolder inside a chapter is a page (e.g. 001, 020). Every page must have a page.tsx file that exports the default component. Pages are ordered alphabetically by folder name unless toc.ts specifies otherwise.

Images

Place page images in src/book/_img/. These are used when creating pages with hotspots. The Hotspot Editor reads from this folder to let you draw hotspot areas.

Order and metadata

Use toc.ts in chapter and page folders to override defaults, set titles, and define table of contents. See Table of contents for details.

On this page