Book config
Book-wide settings in src/book/bookConfig.json
src/book/bookConfig.json is the source of truth for textbook identity and book-wide settings. It lives under src/book/, so tbx update does not overwrite it.
tbx create writes the required fields. Edit this file to change language, type, title, or to add your own values. Import it wherever you need those values:
import bookConfig from "@/book/bookConfig.json";Required fields
| Field | Description |
|---|---|
bookName | Display title (TOC header, index.html title on create/update) |
bookNameSafe | camelCase id used in package.json |
bookSubtitle | Subtitle shown under the title |
bookType | "default" (print + digital) or "minimal" (print only) |
bookLanguage | UI language: "en", "ro", "fr", or "de" |
{
"bookName": "My Textbook",
"bookNameSafe": "myTextbook",
"bookSubtitle": "Year 2",
"bookType": "default",
"bookLanguage": "ro"
}Optional fields wired by the template
The layout passes these to <BookProvider> when they are present. Omit them to keep the provider defaults.
| Field | BookProvider prop | Description |
|---|---|---|
bookRatio | pageRatio | Page image width / height as a number. For 1448×2048 use 0.70703125 (1448 / 2048). |
sidebarWidth | sidebarWidth | TOC sidebar width (CSS length, e.g. "17em") |
The template also reads these directly:
| Field | Default | Description |
|---|---|---|
highlightAtomsOnLoad | false | When true, every atom (hotspot) briefly flashes when a page is shown, then fades out. When false, atoms have no visible style until hovered. |
The flash is off by default. To turn it on, add the field to src/book/bookConfig.json:
{
"highlightAtomsOnLoad": true
}tbx update never touches bookConfig.json, so books that relied on the old always-on flash must add this field themselves. The flash length is set separately with --hotspot-reveal-duration. See Styling.
Custom fields
You can add any other JSON-serializable keys and read them from the same import. Extra keys are typed as unknown, so narrow them when you use them.
{
"bookName": "My Textbook",
"bookNameSafe": "myTextbook",
"bookSubtitle": "Year 2",
"bookType": "default",
"bookLanguage": "ro",
"publisher": "Editura XYZ"
}import bookConfig from "@/book/bookConfig.json";
const publisher = bookConfig.publisher as string;
export function Credits() {
return <p>Published by {publisher}</p>;
}Do not put React components, functions, or image imports here — use a TypeScript module under src/book/ instead (see hotspot icons).
Do not store secrets in this file. It is imported by the app and shipped in the client bundle.